-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.common.js
33 lines (32 loc) · 1.09 KB
/
webpack.common.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
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
entry: {
popup: "./src/popup/popup.js",
background: "./src/background.js",
content: "./src/content.js",
},
module: {
rules: [{ test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/ }], // do not forget to change/install your own TS loader
},
resolve: {
extensions: [".js"],
},
plugins: [
new CleanWebpackPlugin({ cleanStaleWebpackAssets: false }),
// new HtmlWebpackPlugin({ template: "src/popup/popup.html" }),
new CopyWebpackPlugin({
patterns: [
{ from: "./src/manifest.json" },
{ from: "./src/icons/*" },
{ from: "./src/styles/*" },
{ from: "./src/libs/*" },
{ from: "./src/popup/popup.css" },
{ from: "./src/popup/popup.html" },
],
}),
],
output: { filename: "[name].js", path: path.resolve(__dirname, "dist") }, // chrome will look for files under dist/* folder
};