-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.production.config.js
More file actions
43 lines (41 loc) · 1.25 KB
/
webpack.production.config.js
File metadata and controls
43 lines (41 loc) · 1.25 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
const webpack = require("webpack");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const CompressionPlugin = require("compression-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin")
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
publicPath: '/dist/',
output: {
path: __dirname+'/dist',
filename: '[name].js',
publicPath: '/'
},
target: 'web',
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new UglifyJSPlugin({ output: {comments: false} }),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.html$/,
threshold: 10240,
minRatio: 0.8
}),
new ExtractTextPlugin("[name].css"),
new HtmlWebpackPlugin({
template: './index.html'
})
],
module: {
loaders: [
{
test: /\.js$/,
loader: "webpack-strip?strip[]=debug,strip[]=console.log,strip[]=console.info"
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")
},
]
}
};