forked from mattzeunert/javascript-breakpoint-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (46 loc) · 1.18 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
var path = require('path');
var webpack = require('webpack');
var toBuild = [
{
entry: ["devtools-panel", "./devtools-panel.js"],
path: __dirname + "/extension/build",
libraryTarget: "var"
},
{
entry: ["javascript-breakpoint-collection", "./injected-script.js"],
path: __dirname + "/extension/build",
libraryTarget: "var"
},
{
entry: ["node", "./injected-script"],
//needs separate build becasue otherwise the script fails
// on pages with a global `define` function
libraryTarget: "umd",
path: __dirname + "/dist/"
}
]
function makeConfig(item){
var entry = {};
entry[item.entry[0]] = item.entry[1];
return {
entry: entry,
devtool: "source-map",
output: {
path: item.path,
filename: '[name].js',
libraryTarget: item.libraryTarget
},
module: {
loaders: [
{
test: /.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
presets: ['es2015', 'react']
}
]
}
};
}
var configs = toBuild.map(makeConfig);
module.exports = configs;