-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.base.js
66 lines (58 loc) · 1.49 KB
/
webpack.base.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
62
63
64
65
66
const { resolve } = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
devServer: {
contentBase: resolve(__dirname, "src"),
historyApiFallback: true,
},
entry: {
background: resolve(__dirname, "src/background.ts"),
inject: resolve(__dirname, "src/inject.ts"),
popup: resolve(__dirname, "src/popup/index.tsx"),
options: resolve(__dirname, "src/options/index.tsx"),
foreground: resolve(__dirname, "src/foreground/index.tsx"),
},
output: {
filename: "[name].bundle.js",
path: resolve(__dirname, "dist"),
},
module: {
rules: [
{
exclude: /node_modules/,
test: /\.tsx?$/,
use: "ts-loader",
},
],
},
resolve: {
extensions: [".ts", ".tsx", ".js"],
},
plugins: [
new HtmlWebpackPlugin({
filename: "popup.html",
template: "src/popup/index.html",
chunks: ["popup"],
}),
new HtmlWebpackPlugin({
filename: "options.html",
template: "src/options/index.html",
chunks: ["options"],
}),
new HtmlWebpackPlugin({
filename: "foreground.html",
template: "src/foreground/index.html",
chunks: ["foreground"],
}),
new CopyWebpackPlugin({
patterns: [
{ from: "src/manifest.json", to: "[name].[ext]" },
{ from: "src/assets/*.png", to: "[name].[ext]" },
],
}),
],
watchOptions: {
ignored: /node_modules/,
},
};