forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.devtools.js
37 lines (32 loc) · 1 KB
/
webpack.config.devtools.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
"use strict";
const webpack = require('webpack');
const getConfig = require("./config/config").getConfig;
const { DefinePlugin } = webpack;
const ignoreRegexes = [
/chrome-remote-debug-protocol/
];
module.exports = webpackConfig => {
webpackConfig.output.library = "Debugger";
webpackConfig.externals = [
function(context, request, callback) {
// Any matching paths here won't be included in the bundle.
if(ignoreRegexes.some(r => r.test(request))) {
callback(null, "var {}");
return;
}
callback();
}
];
// Remove the existing DefinePlugin so we can override it.
const plugins = webpackConfig.plugins.filter(p => !(p instanceof DefinePlugin));
webpackConfig.plugins = plugins.concat([
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || "production"),
TARGET: JSON.stringify("firefox-panel")
},
"DebuggerConfig": JSON.stringify(getConfig())
})
]);
return webpackConfig;
};