-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·48 lines (41 loc) · 1.16 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
/* eslint @typescript-eslint/no-var-requires: off */
const path = require("path");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const DEMO_PATH = path.resolve(__dirname, "demo");
const DEMO_DIST_PATH = path.resolve(__dirname, "demo_dist");
module.exports = {
entry: DEMO_PATH,
output: {
filename: "bundle.js",
path: DEMO_DIST_PATH,
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
module: {
rules: [
{ test: /\.(ts|js)x?$/, loader: "babel-loader", exclude: /node_modules/ },
],
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: path.join(DEMO_PATH, "index.html"),
}),
new ForkTsCheckerWebpackPlugin(),
],
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
// sourceMap: true, // Must be set to true if using source-maps in production
terserOptions: {
// https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
},
}),
],
},
};