|
1 | | -var baseConfig = require('./webpack.common') |
2 | | -var webpack = require('webpack') |
3 | | -var path = require('path') |
| 1 | +const common = require('./webpack.common.js') |
| 2 | +const htmlexport = require('./webpack.htmlexport') |
| 3 | +const merge = require('webpack-merge') |
| 4 | +const path = require('path') |
4 | 5 | const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') |
5 | | -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') |
6 | | -const MiniCssExtractPlugin = require('mini-css-extract-plugin') |
7 | 6 |
|
8 | | -module.exports = [Object.assign({}, baseConfig, { |
9 | | - plugins: baseConfig.plugins.concat([ |
10 | | - new webpack.DefinePlugin({ |
11 | | - 'process.env': { |
12 | | - 'NODE_ENV': JSON.stringify('production') |
13 | | - } |
14 | | - }) |
15 | | - ]), |
16 | | - |
17 | | - optimization: { |
18 | | - minimizer: [ |
19 | | - new UglifyJsPlugin({ |
20 | | - parallel: true, |
21 | | - cache: true |
22 | | - }) |
23 | | - ], |
24 | | - splitChunks: { |
25 | | - chunks: 'async', |
26 | | - minChunks: Infinity |
| 7 | +module.exports = [ |
| 8 | + merge(common, { |
| 9 | + mode: 'production', |
| 10 | + output: { |
| 11 | + path: path.join(__dirname, 'public/build'), |
| 12 | + publicPath: '/build/', |
| 13 | + filename: '[name].[contenthash].js' |
27 | 14 | } |
28 | | - }, |
29 | | - |
30 | | - output: { |
31 | | - path: path.join(__dirname, 'public/build'), |
32 | | - publicPath: '/build/', |
33 | | - filename: '[id].[name].[hash].js' |
34 | | - // baseUrl: '<%- url %>' |
35 | | - } |
36 | | -}), { |
37 | | - // This Chunk is used in the 'save as html' feature. |
38 | | - // It is embedded in the html file and contains CSS for styling. |
39 | | - |
40 | | - entry: { |
41 | | - htmlExport: path.join(__dirname, 'public/js/htmlExport.js') |
42 | | - }, |
43 | | - |
44 | | - output: { |
45 | | - path: path.join(__dirname, 'public/build'), |
46 | | - publicPath: '/build/', |
47 | | - filename: '[name].js' |
48 | | - }, |
49 | | - plugins: [ |
50 | | - new webpack.DefinePlugin({ |
51 | | - 'process.env': { |
52 | | - 'NODE_ENV': JSON.stringify('production') |
53 | | - } |
54 | | - }), |
55 | | - new MiniCssExtractPlugin({ |
56 | | - filename: 'html.min.css' |
57 | | - }) |
58 | | - ], |
59 | | - |
60 | | - optimization: { |
61 | | - minimizer: [ |
62 | | - new OptimizeCSSAssetsPlugin({}) |
63 | | - ] |
64 | | - }, |
65 | | - |
66 | | - module: { |
67 | | - rules: [{ |
68 | | - test: /\.css$/, |
69 | | - use: [ |
70 | | - MiniCssExtractPlugin.loader, |
71 | | - 'css-loader' |
| 15 | + }), |
| 16 | + merge(htmlexport, { |
| 17 | + mode: 'production', |
| 18 | + optimization: { |
| 19 | + minimizer: [ |
| 20 | + new OptimizeCSSAssetsPlugin({}) |
72 | 21 | ] |
73 | | - }] |
74 | | - } |
75 | | -}] |
| 22 | + } |
| 23 | + })] |
0 commit comments