-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
45 lines (44 loc) · 964 Bytes
/
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
const UglifyJSPlugin = require("uglifyjs-webpack-plugin")
const merge = require("webpack-merge")
const webpack = require("webpack")
const common = {
devtool: "source-map",
entry: {
counter: "./counter",
github: "./github",
},
module: {
rules: [
{
include: /counter|github/,
loader: "awesome-typescript-loader",
test: /\.tsx?$/,
},
],
},
resolve: {
extensions: [".js", ".ts", ".tsx"],
},
}
if (process.env.npm_lifecycle_event === "build") {
module.exports = merge(common, {
output: {
filename: "dist/[name]/app.js",
},
plugins: [new UglifyJSPlugin({ sourceMap: true })],
})
} else {
module.exports = merge(common, {
devServer: {
hot: true,
},
output: {
filename: "[name]/app.js",
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
})
}