UNPKG

1.69 kBJavaScriptView Raw
1var path = require('path');
2var webpack = require('webpack');
3var ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
4//const CleanWebpackPlugin = require('clean-webpack-plugin');
5
6module.exports = {
7 devtool: false,
8 resolve: {
9 extensions: ['.js', '.jsx'],
10 },
11 entry: {
12 /*
13 shim: [
14 'console-polyfill',
15 'es5-shim',
16 'es5-shim/es5-sham',
17 'html5shiv',
18 ],*/
19 vendor: [
20 'raf/polyfill',
21 'babel-polyfill',
22 'url-polyfill',
23 'es6-promise',
24 'react',
25 'react-dom',
26 'antd',
27 'redux',
28 'prop-types',
29 'react-redux',
30 'mk-rc-select',
31 'moment',
32 'md5',
33 'immutable',
34 'history',
35 'fastclick',
36 'classnames',
37 'omit.js',
38 'react-keydown',
39 'react-resizable',
40 'react-json-tree',
41 'react-viewer',
42 'whatwg-fetch',
43 'fixed-data-table-2'
44 ]
45 },
46 output: {
47 path: path.join(__dirname, 'vendor'),
48 filename: '[name].dll.js',
49 library: '[name]_[chunkhash:8]',
50 // library 与 DllPlugin 中的 name 一致
51 },
52 plugins: [
53 //new CleanWebpackPlugin(['vendor']),
54 new webpack.DefinePlugin({
55 'process.env': { 'NODE_ENV': JSON.stringify('production') },
56 }),
57 new webpack.ContextReplacementPlugin(
58 /moment[\\/]locale$/i,
59 /^\.\/zh-cn$/i,
60 ),
61 // new webpack.IgnorePlugin(/^\.\/locale$/i, /moment$/i),
62 new webpack.DllPlugin({
63 context: __dirname,
64 name: '[name]_[chunkhash:8]',
65 path: path.join(__dirname, 'vendor', '[name].manifest.json'),
66 }),
67 new ParallelUglifyPlugin({
68 cacheDir: '.cache/',
69 uglifyJS: {
70 output: {
71 comments: false
72 },
73 compress: {
74 warnings: false
75 }
76 }
77 }),
78
79 ],
80};
\No newline at end of file