-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
41 lines (39 loc) · 1.16 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
const path = require('path');
const CopyWebpackPlugin = require("copy-webpack-plugin");
const fs = require("fs");
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
const version = packageJson.version;
module.exports = {
entry: {
content: './src/content.js',
popup: './src/popup.js',
ace: './node_modules/ace-builds/src-min-noconflict/ace.js',
json: './node_modules/ace-builds/src-min-noconflict/mode-json.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
},
optimization: {
// minimize: false
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: "manifest.org.json",
to: "manifest.json",
transform(content) {
const manifestJson = JSON.parse(content.toString());
manifestJson.version = version;
return JSON.stringify(manifestJson, null, 2);
},
},
{ from: "src/popup.html", to: "popup.html" },
{ from: "src/popup.css", to: "popup.css" },
{ from: "src/injected.js", to: "injected.js" },
{ from: "icons", to: "icons" },
],
}),
],
};