-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (66 loc) · 1.74 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
64
65
66
67
68
69
70
71
72
73
74
75
76
const CopyPlugin = require('copy-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader');
const path = require('path');
const { version } = require('./package.json');
const config = {
mode: process.env.NODE_ENV,
context: path.join(__dirname, 'src'),
entry: {
"background/main": './background/main.js',
"browser_action/index": './browser_action/index.js',
"browser_action/editFilter": './browser_action/editFilter.js',
"browser_action/debug/index": './browser_action/debug/index.js',
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [
'vue-style-loader',
{
loader: 'css-loader',
options: {
esModule: false
}
}
]
}
]
},
plugins: [
new VueLoaderPlugin(),
new CopyPlugin({
patterns: [
{ from: 'static', to: './' },
{ from: 'res', to: './res/' },
{
from: 'manifest.json',
to: 'manifest.json',
transform: (content) => {
const jsonContent = JSON.parse(content);
jsonContent.version = version;
if (config.mode === 'development') {
//jsonContent['content_security_policy'] = { "extension_pages": "script-src 'self' 'unsafe-eval'; object-src 'self'" };
}
return JSON.stringify(jsonContent, null, 2);
},
},
]
})
],
resolve: {
extensions: [".vue", ".js"]
},
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
}
};
if (config.mode === 'development') {
config.devtool = 'inline-source-map';
}
module.exports = config;