-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.demo.js
78 lines (75 loc) · 2.15 KB
/
webpack.config.demo.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
72
73
74
75
76
77
78
const path = require('path');
const webpack = require('webpack');
const env = process.env.NODE_ENV;
module.exports = [{
mode: "development",
entry: {
"demo" : path.resolve(__dirname, 'demo/demo.js')
},
target: "web",
output: {
path: path.resolve(__dirname, 'demo'),
publicPath: "/demo/",
filename: "demo-compiled.js",
libraryTarget: "umd",
library: "[name]",
umdNamedDefine: true
},
// https://github.com/hapijs/joi/issues/665
// stub modules on client side depended on by joi (a dependency of jwt)
node: {
net: "empty",
tls: "empty",
dns: "empty",
},
externals: {
'xmlhttprequest' : '{XMLHttpRequest:XMLHttpRequest}',
'react' : {
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
root: 'React',
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'react-dom',
root: 'ReactDOM',
},
'react-workflow-viz' : "react-workflow-viz"
},
module: {
rules: [
// Strip @jsx pragma in react-forms, which makes babel abort
{
test: /\.js$/,
loader: 'string-replace-loader',
enforce: 'pre',
query: {
search: '@jsx',
replace: 'jsx',
}
},
// add babel to load .js files as ES6 and transpile JSX
{
test: /\.(js|jsx)$/,
include: [
path.resolve(__dirname, 'demo/demo.js')
],
use: [
{
loader: 'babel-loader'
}
]
}
]
},
optimization: { minimize : false },
resolve : {
extensions : [".webpack.js", ".web.js", ".js", ".json", ".jsx"],
},
devtool: 'eval',
// Inform our code of what build we're on.
// This works via a find-replace.
plugins: [ new webpack.DefinePlugin({ 'BUILDTYPE' : JSON.stringify(env) }) ]
}];