Last active
June 30, 2017 01:18
-
-
Save vamsiampolu/64b31fcaae160d3c4b9a56eadafb5294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clean-webpack-plugin: /Users/localuser/lendi/learning/antd-forms/src/code-splitting/build/*.* has been removed. | |
76% basic chunk optimization/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289 | |
for(const module of chunk.modulesIterable) { | |
^ | |
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined | |
at usedChunks.reduce (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:289:29) | |
at Array.reduce (native) | |
at CommonsChunkPlugin.getExtractableModules (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:288:46) | |
at targetChunks.forEach (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:136:38) | |
at Array.forEach (native) | |
at Compilation.compilation.plugin (/Users/localuser/lendi/learning/antd-forms/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js:102:18) | |
at Compilation.applyPluginsBailResult1 (/usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:120:27) | |
at Compilation.seal (/usr/local/lib/node_modules/webpack/lib/Compilation.js:571:9) | |
at /usr/local/lib/node_modules/webpack/lib/Compiler.js:488:16 | |
at /usr/local/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:225:11 | |
at _addModuleChain (/usr/local/lib/node_modules/webpack/lib/Compilation.js:477:11) | |
at processModuleDependencies.err (/usr/local/lib/node_modules/webpack/lib/Compilation.js:448:13) | |
at _combinedTickCallback (internal/process/next_tick.js:95:7) | |
at process._tickCallback (internal/process/next_tick.js:161:9) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new CommonsChunkPlugin({ | |
name: 'vendor' | |
}), | |
new CommonsChunkPlugin({ | |
name: 'manifest', | |
minChunks: Infinity | |
}), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack') | |
const path = require('path') | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
const CleanWebpackPlugin = require('clean-webpack-plugin') | |
const CommonsChunkPlugin = webpack.optimize.CommonsChunkPlugin | |
const NamedModulesPlugin = webpack.NamedModulesPlugin | |
const vendor = [ | |
'react', | |
'redux', | |
'react-router', | |
'react-redux', | |
'react-jsonschema-form' | |
] | |
const config = { | |
entry: { | |
main: './index.js', | |
vendor | |
}, | |
output: { | |
chunkFilename: '[name]-split-chunk.[chunkhash].js', | |
filename: '[name]-entry-chunk.[chunkhash].js', | |
path: path.resolve('./build') | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.js$/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
babelrc: false, | |
presets: ['es2015', 'react'], | |
plugins: [ | |
['transform-class-properties'], | |
['transform-object-rest-spread'], | |
['syntax-dynamic-import'], | |
[ | |
'import', | |
{ | |
libraryName: 'antd', | |
style: 'css' | |
} | |
] | |
] | |
} | |
}, | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
{ | |
loader: 'style-loader' | |
}, | |
{ | |
loader: 'css-loader' | |
} | |
] | |
}, | |
{ | |
test: /\.svg$/, | |
use: [ | |
{ | |
loader: 'svg-sprite-loader' | |
} | |
] | |
}, | |
{ | |
test: /\.json$/, | |
use: [ | |
{ | |
loader: 'json-loader' | |
} | |
] | |
} | |
] | |
}, | |
devtool: 'source-map', | |
plugins: [ | |
new CleanWebpackPlugin([path.resolve('./build/*.*')]), | |
new NamedModulesPlugin(), | |
new CommonsChunkPlugin({ | |
names: ['vendor', 'manifest'] | |
}), | |
new HtmlWebpackPlugin() | |
] | |
} | |
module.exports = config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment