-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
51 lines (50 loc) · 1.34 KB
/
Copy pathwebpack.prod.js
File metadata and controls
51 lines (50 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const webpack = require('webpack')
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const WebpackMd5Hash = require('webpack-md5-hash');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const taskUtils = require('./utils/task')();
module.exports = merge(common, {
mode: 'production',
output: {
filename: '[name].[chunkhash].js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
'css-loader',
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
includePaths: ['./node_modules']
}
}
]
})
}
]
},
plugins: [
new webpack.DefinePlugin(taskUtils.iterObj(require('./config/config.prod.json'))),
new ExtractTextPlugin(
{filename: '[name].[hash].css', disable: false, allChunks: true}
),
new HtmlWebpackPlugin({
template: 'src/index-prod.tmpl',
filename: 'index.html',
inject: false,
hash: true,
showErrors: true,
chunksSortMode: 'none'
}),
new WebpackMd5Hash()
]
})