-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
77 lines (69 loc) · 1.71 KB
/
vue.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
const ExtensionReloader = require("webpack-extension-reloader");
// const path = require("path");
module.exports = {
// productionSourceMap: false,
lintOnSave: false,
// filenameHashing: false,
indexPath: "html/popup.html",
// pages: {
// "html/popup": {
// entry: "src/popup/popup.js",
// template: "src/popup/popup.html",
// title: "Popup",
// },
// "background/background": {
// entry: "src/background/background.js",
// // template: "src/background/background.html",
// },
// },
chainWebpack: (config) => {
config.entryPoints.clear().end();
config
.entry("popup")
.add("./src/popup/popup.js")
.end();
config
.entry("background")
.add("./src/background/background.js")
.end();
config.output.filename((file) =>
file.chunk.name !== "background"
? "js/[name].[contenthash:8].js"
: "js/[name].js",
);
config.plugin("html").tap((args) => {
args[0].template = "./src/popup/popup.html";
return args;
});
config.plugin("copy").tap(([options]) => {
const manifest = {
from: "./src/manifest.json",
to: "./manifest.json",
};
options = [...options, manifest];
return [options];
});
if (process.env.NODE_ENV !== "production") {
config.plugin("extension-reloader").use(ExtensionReloader, [
{
entries: {
background: "js/background",
extensionPage: ["popup"],
},
},
]);
}
config.optimization.delete("splitChunks");
},
// configureWebpack: (config, options) => {
// config.plugins.push(
// new ExtensionReloader({
// // manifest: path.resolve(__dirname, "src/manifest.json"),
// entries: {
// background: "js/background",
// extensionPage: ["popup"],
// },
// }),
// );
// },
};