-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.config.js
61 lines (58 loc) · 1.27 KB
/
webpack.config.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
const webpack = require("webpack");
const merge = require("webpack-merge");
const resolve = require("path").resolve;
var config = {
devtool: "cheap-module-source-map",
entry: {
background: "./src/background",
contentscript: "./src/contentscript",
popup: "./src/popup"
},
output: {
filename: "[name].js",
sourceMapFilename: "[name].js.map",
path: resolve(__dirname, "extension/dist"),
},
module: {
rules: [{
test: /\.js$/,
use: "babel-loader",
include: [
resolve(__dirname, "src")
],
exclude: [
resolve(__dirname, "node_modules")
]
}]
},
plugins: []
};
if (process.env.NODE_ENV === "production") {
config = merge(config, {
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify("production")
}
}),
new webpack.optimize.UglifyJsPlugin({
beautify: false,
sourceMap: true,
mangle: {
screw_ie8: true,
keep_fnames: true
},
compress: {
screw_ie8: true,
warnings: false
},
comments: false
})
]
});
}
module.exports = config;