-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwebpack.config.js
63 lines (61 loc) · 1.48 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 CopyWebpackPlugin = require("copy-webpack-plugin");
// const ChromeExtensionReloader = require("webpack-chrome-extension-reloader");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
module.exports = {
devServer: {
contentBase: "./dist",
},
entry: {
content: "./src/js/content.js",
popup: "./src/js/popup.js",
},
optimization: {
minimize: true
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "js/[name].js",
},
module: {
rules: [{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }],
},
plugins: [
// new ChromeExtensionReloader({
// port: 9097,
// reloadPage: false,
// }),
new CleanWebpackPlugin(),
new CopyWebpackPlugin({
patterns: [
{
from: "src/manifest.json",
to: "manifest.json",
},
{
context: path.resolve(__dirname, "src", "icons"),
from: "**/*",
to: "icons/",
},
{
context: path.resolve(__dirname, "src", "css"),
from: "**/*",
to: "css/",
},
{
context: path.resolve(__dirname, "src", "fonts"),
from: "**/*",
to: "fonts/",
},
{
from: "src/html/*.html",
to: "html/[name].html",
},
{
from: "node_modules/webextension-polyfill/dist/browser-polyfill.min.js",
to: "js/",
},
],
}),
],
};