-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
48 lines (45 loc) · 1.2 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
const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const MODE = process.env.NODE_ENV || "development"
module.exports = {
mode: MODE,
devtool: "inline-source-map",
entry: {
background: `${__dirname}/src/background.ts`,
content_script: `${__dirname}/src/content_script.ts`,
subsakai: `${__dirname}/src/subsakai.tsx`
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
}
]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
},
resolve: {
extensions: [".ts", ".js", ".tsx"]
},
plugins: [
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{ from: "./public", to: "./" },
{ from: "./_locales", to: "./_locales" }
]
})
]
};
if (MODE === "production") {
module.exports.optimization = {
minimize: true,
minimizer: [new TerserPlugin()]
};
}