-
Notifications
You must be signed in to change notification settings - Fork 10
/
vue.config.js
51 lines (46 loc) · 1.29 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
const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
// Generate pages object
const pagesObj = {};
const chromeName = ["popup", "options", "content_script", "background", "inpage"];
chromeName.forEach(name => {
pagesObj[name] = {
entry: `src/${name}/index.ts`,
template: "public/index.html",
filename: `${name}.html`
};
});
const plugins =
process.env.NODE_ENV === "production"
? [
{
from: path.resolve("src/manifest.production.json"),
to: `${path.resolve("dist")}/manifest.json`
}
]
: [
{
from: path.resolve("src/manifest.development.json"),
to: `${path.resolve("dist")}/manifest.json`
}
];
module.exports = {
pages: pagesObj,
configureWebpack: config => {
config.plugins.push(new CopyWebpackPlugin(plugins));
config.output.filename = 'js/[name].js';
config.output.chunkFilename = 'js/[name].js';
},
chainWebpack: config => {
config.plugin('copy')
.tap(args => {
args[0].push({
from: path.resolve(__dirname, 'src/_locales'),
to: path.resolve(__dirname, 'dist/_locales'),
toType: 'dir',
ignore: ['.DS_Store']
})
return args
})
}
};