-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.cfg.js
55 lines (53 loc) · 1.32 KB
/
webpack.cfg.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 webpack = require("webpack");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const publicConfig = {
devtool: false,
// devtool: "source-map",
module: {
rules: [
{
test: /_\.css$/i,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader?modules&localIdentName=[hash:base64:8]"],
}),
},
{
test: /[^_]\.css$/i,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "postcss-loader"],
}),
},
{
test: /\.less$/i,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: ["css-loader", "postcss-loader", "less-loader"],
}),
},
],
},
plugins: [
new CleanWebpackPlugin(["dist"]),
new webpack.DefinePlugin({
"process.env": { "NODE_ENV": JSON.stringify("production") },
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HashedModuleIdsPlugin(),
new UglifyJSPlugin({
sourceMap: false,
}),
new ExtractTextPlugin({
filename: "css/[name].[contenthash:5].css",
allChunks: true,
}),
new webpack.LoaderOptionsPlugin({
minimize: true,
}),
],
};
module.exports = publicConfig;