|
1 | 1 | const base = require('./base.js'); |
| 2 | +const PATH = require('./build_path'); |
2 | 3 | const objectAssign = require('object-assign'); |
3 | 4 | const webpack = require('webpack'); |
| 5 | +const HtmlWebpackPlugin = require('html-webpack-plugin'); |
4 | 6 | const MiniCssExtractPlugin = require('mini-css-extract-plugin'); |
5 | 7 | const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); |
6 | 8 |
|
7 | 9 | const config = objectAssign(base, { |
8 | 10 | mode: 'production', |
9 | 11 | devtool: 'cheap-source-map', |
10 | 12 | output: { |
11 | | - publicPath: '/', |
12 | | - filename: '[name]-[chunkhash].js' |
| 13 | + publicPath: '/react-inputs-validation/dist/', |
| 14 | + filename: '[name]-[chunkhash].js', |
13 | 15 | }, |
14 | 16 | optimization: { |
15 | 17 | minimizer: [ |
16 | 18 | new UglifyJSPlugin({ |
17 | 19 | uglifyOptions: { |
18 | 20 | output: { |
19 | | - comments: false |
| 21 | + comments: false, |
20 | 22 | }, |
21 | 23 | compress: { |
22 | | - warnings: false |
23 | | - } |
24 | | - } |
25 | | - }) |
26 | | - ] |
27 | | - } |
| 24 | + warnings: false, |
| 25 | + }, |
| 26 | + }, |
| 27 | + }), |
| 28 | + ], |
| 29 | + }, |
28 | 30 | }); |
29 | 31 |
|
30 | | -config.plugins.push(new MiniCssExtractPlugin({ filename: 'css/[name]-[hash].css' })); |
| 32 | +config.plugins.push( |
| 33 | + new MiniCssExtractPlugin({ filename: 'css/[name]-[hash].css' }), |
| 34 | + new HtmlWebpackPlugin({ |
| 35 | + template: PATH.HTML_PATH + '/layout.html', |
| 36 | + title: 'react-inputs-validation', |
| 37 | + page: 'index', |
| 38 | + filename: '../index.html', |
| 39 | + hash: false, |
| 40 | + chunksSortMode: function(chunk1, chunk2) { |
| 41 | + var orders = ['index']; |
| 42 | + var order1 = orders.indexOf(chunk1.names[0]); |
| 43 | + var order2 = orders.indexOf(chunk2.names[0]); |
| 44 | + if (order1 > order2) { |
| 45 | + return 1; |
| 46 | + } else if (order1 < order2) { |
| 47 | + return -1; |
| 48 | + } else { |
| 49 | + return 0; |
| 50 | + } |
| 51 | + }, |
| 52 | + }), |
| 53 | +); |
31 | 54 |
|
32 | 55 | module.exports = config; |
0 commit comments