forked from rlesniak/tind3r.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
55 lines (51 loc) · 1.28 KB
/
webpack.config.prod.js
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
52
53
54
55
const path = require('path');
const webpack = require('webpack');
const webpackConfig = require('./webpack.config.dev');
const AssetsPlugin = require('assets-webpack-plugin');
webpackConfig.module.rules[1].use = [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{
loader: 'sass-loader',
options: { includePaths: [path.resolve(__dirname, 'src', 'styles')] },
},
];
module.exports = Object.assign(webpackConfig, {
entry: [
'babel-polyfill',
'./src/index.js',
],
output: Object.assign(webpackConfig.output, {
filename: '[name].[chunkhash].v2.js',
}),
devtool: 'source-map',
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: false,
mangle: false,
sourceMap: true,
output: {
comments: false,
},
}),
new AssetsPlugin({
path: path.join(__dirname, 'dist'),
processOutput: asset => (
JSON.stringify([
asset.vendor.js,
asset.main.js,
])
),
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: module => module.context && module.context.indexOf('node_modules') !== -1,
}),
],
devServer: {},
});