-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
53 lines (49 loc) · 1.4 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
var WebpackShellPlugin = require("webpack-shell-plugin")
function getBaseConfig(){
return {
entry: "./src/ohd-with-babel.js",
output: {
path: "./dist/",
filename: "ohd.js",
library: "objectHistoryDebugger",
libraryTarget: "umd"
},
// We don't want to process our own code with the babel plugin,
// so include it as a string
devtool: "eval",
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel"
},
{
test: /\.json$/,
loader: "json"
}
]
},
node: {
fs: 'empty',
module: 'empty',
net: 'empty',
},
plugins: []
}
}
var npmPluginConfig = getBaseConfig();
npmPluginConfig.plugins.push(new WebpackShellPlugin({
onBuildExit: [
"node ./src/scripts/make-global-object-work-in-strict-mode.js"
]
}))
var demoConfig = getBaseConfig();
demoConfig.output.path = "./docs/demo/dist"
// The demo doesn't use `eval` or `new Function`, so we don't
// need to load Babel, which would make our file 2MB+
demoConfig.externals = {
"babel-core": "babelNotNeeded",
"babylon": "babelNotNeeded"
}
module.exports = [npmPluginConfig, demoConfig];