-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
63 lines (57 loc) · 1.46 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
62
63
const path = require("path");
const { merge } = require("webpack-merge");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const common = require("./webpack.common.js");
const appConfig = {
entry: "./src/index.tsx",
output: {
path: path.resolve(__dirname, "build"),
filename: "static/js/app.bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
template: "./public/index.html",
filename: "index.html",
inject: "body",
}),
],
};
const backgroundConfig = {
entry: "./src/background/background.ts",
output: {
path: path.resolve(__dirname, "build/static/js"),
filename: "background.bundle.js",
},
};
const contentConfig = {
entry: "./src/content/content.ts",
output: {
path: path.resolve(__dirname, "build/static/js"),
filename: "content.bundle.js",
},
};
const injectConfig = {
entry: "./src/content/inject.ts",
output: {
path: path.resolve(__dirname, "build/static/js"),
filename: "inject.bundle.js",
},
};
const copyConfig = {
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: "public/images", to: "images" },
{ from: "public/manifest.json", to: "manifest.json" },
{ from: "public/robots.txt", to: "robots.txt" },
],
}),
],
};
module.exports = [
merge(common, appConfig, copyConfig),
merge(common, backgroundConfig),
merge(common, contentConfig),
merge(common, injectConfig),
];