-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.production.js
executable file
·78 lines (76 loc) · 1.83 KB
/
webpack.config.production.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const path = require('path');
const merge = require('webpack-merge');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const config = require('./webpack.config.base');
const GLOBALS = {
'process.env': {
'NODE_ENV': JSON.stringify('production')
},
__DEV__: false
};
module.exports = merge(config, {
debug: false,
devtool: 'cheap-module-source-map',
entry: {
application: './src/index.js'
},
plugins: [
// new CopyWebpackPlugin([
// {
// from: path.join(__dirname, '../src/client/assets/images'),
// to: 'images'
// }
// ]),
// Avoid publishing files when compilation fails
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin(GLOBALS),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
'screw_ie8': true
},
output: {
comments: false
},
sourceMap: false
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new ExtractTextPlugin({
filename: 'css/app.css',
allChunks: true
})
],
module: {
noParse: /\.min\.js$/,
loaders: [
// Sass
{
test: /\.scss$/,
include: [
path.resolve(__dirname, 'src')
],
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style',
loader: [
{ loader: 'css', query: { sourceMap: true } },
'postcss',
{ loader: 'sass', query: { outputStyle: 'compressed' } }
]
})
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style',
loader: ['css', 'postcss']
})
}
]
},
});