-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathwebpack.config.js
71 lines (67 loc) · 1.79 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
const ExtensionReloader = require('webpack-extension-reloader');
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const contentScripts = {
content: './content/index.js'
}
const extensionPages = {
options: './options/index.js',
popup: './popup/index.js',
}
let config = {
mode: process.env.NODE_ENV,
context: __dirname + '/src'
};
let ExtensionConfig = Object.assign({}, config, {
entry: {
background: './background/index.js',
...contentScripts,
...extensionPages
},
output: {
path: __dirname + '/extension/dist/',
filename: '[name].dist.js',
},
plugins: [
new ExtensionReloader({
port: 9090,
reloadPage: true,
entries: {
contentScript: Object.keys(contentScripts),
extensionPage: Object.keys(extensionPages),
background: 'background'
}
}),
new CopyPlugin({
patterns: [
{
from: './icons/*',
to: __dirname + '/extension/dist/',
},
{
from: './popup/index.html',
to: __dirname + '/extension/dist/popup.html',
},
{
from: './popup/index.css',
to: __dirname + '/extension/dist/popup.css',
},
{
from: './options/index.html',
to: __dirname + '/extension/dist/options.html',
},
{
from: './options/index.css',
to: __dirname + '/extension/dist/options.css',
},
{
from: './content/index.css',
to: __dirname + '/extension/dist/content.css',
},
]
}),
]
});
module.exports = [
ExtensionConfig,
];