-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
48 lines (48 loc) · 1.33 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 CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
mode: "production", // development
entry: {
"./background": "./js/background.js",
"./js/insert-community": "./js/insert-community.js",
"./js/popup": "./js/popup.js"
},
devtool: "inline-source-map",
output: {
// "[name].[hash].bundle.js"
filename: "[name].js",
path: path.resolve(__dirname, "dist"),
publicPath: "/",
clean: true
},
module: {
rules: [
{
test: /\.css$/,
use: [
// "style-loader", //将js中的css通过style方式注入到html中
"css-loader" // 加载处理css文件
]
}
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: "manifest.json" },
{ from: "img/", to: "img/", toType: "dir" },
{ from: "html", to: "html", toType: "dir" },
{ from: "css", to: "css", toType: "dir" },
{ from: "node_modules/chrome-extension-file-icons-js/css/style.css", to: "css/file-icon.css" },
{ from: "node_modules/chrome-extension-file-icons-js/fonts/", to: "fonts/", toType: "dir" }
]
})
],
devServer: {
static: "./dist", // 告知 dev server,从什么位置查找静态文件
compress: true,
port: 9000,
host: "0.0.0.0",
hot: true
}
};