-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.production.js
66 lines (64 loc) · 1.71 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
'use strict';
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
context: path.join(__dirname, './'),
entry: {
js: './src/client/index.js'
},
module: {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
exclude: /node_modules/
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!sass-loader')
}
]
},
output: {
path: __dirname + '/dist/public',
filename: 'bundle.min.js'
},
resolve: {
extensions: ['', '.js']
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
},
output: {
comments: false
}
}),
new HtmlWebpackPlugin({
template: './src/client/views/index.html', // Move the index.html file...
minify: { // Minifying it while it is parsed
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
},
inject: true, // inject all files that are generated by webpack, e.g. bundle.js, style.css with the correct HTML tags
filename: '../views/index.html'
}),
new ExtractTextPlugin("style.css"),
]
};