내 웹팩 구성은 웹팩의 모든 청크를 축소에되지 않습니다UglifyJS 플러그인은
{ devtool: 'source-map',
output:
{ path: '/Users/apple/Desktop/WorkSpace/GitHub/Webpack-Boilerplate/dist',
filename: '[name].bundle.js.[hash:8]',
sourceMapFilename: '[name].bundle.map',
publicPath: '/' },
plugins:
[ OccurrenceOrderPlugin { preferEntry: undefined },
DefinePlugin { definitions: [Object] },
ProvidePlugin { definitions: {} },
ExtractTextPlugin { filename: '[name].css', options: {}, id: 1 },
CommonsChunkPlugin {
chunkNames: 'vendors',
filenameTemplate: 'vendors.bundle.js',
minChunks: Infinity,
selectedChunks: undefined,
async: undefined,
minSize: undefined,
ident: '/Users/apple/Desktop/WorkSpace/GitHub/Webpack-Boilerplate/node_modules/webpack/lib/optimize/CommonsChunkPlugin.js0' },
HtmlWebpackPlugin { options: [Object] },
HtmlWebpackPlugin { options: [Object] },
HtmlWebpackPlugin { options: [Object] },
HtmlWebpackPlugin { options: [Object] },
UglifyJsPlugin { options: [Object] } ],
module: { loaders: [ [Object], [Object], [Object], [Object] ] },
postcss:
[ { [Function]
options: [Object],
info: [Function],
postcssPlugin: 'autoprefixer',
postcssVersion: '5.0.14' },
{ [Function: creator] postcss: [Object], process: [Function] } ],
resolve:
{ alias:
{ libs: '/Users/apple/Desktop/WorkSpace/GitHub/Webpack-Boilerplate/dev-config/libs',
nm: '/Users/apple/Desktop/WorkSpace/GitHub/Webpack-Boilerplate/dev-config/node_modules',
assets: '/Users/apple/Desktop/WorkSpace/GitHub/Webpack-Boilerplate/dev-config/assets' } },
externals: { jquery: 'jQuery', pageResponse: 'pageResponse' },
entry:
{ index: './src/index.js',
helloworld: './src/modules/helloworld/container/app.js',
counter: './src/modules/counter/container/app.js',
form: './src/modules/form/form.js' } }
생성 vendors.bundle.js
덩어리가 축소 된 것이 이상이지만, 다른 덩어리가 아니다. 전체 프로젝트는 여기에 : https://github.com/wxyyxc1992/Webpack-React-Redux-Boilerplate, 단지 npm run build
을 사용하여 프로젝트를 빌드하고 dist 디렉토리를보십시오.
누구나 나중에이 문제가 발생하면 다음과 같이 크게 도움이 된 것을 발견했습니다. https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/104#issuecomment-358646531 – arthurakay