-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
47 lines (45 loc) · 1.35 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
var debug = process.env.NODE_ENV !== 'production'
var path = require('path')
var babelOptions = {
'presets': ['@babel/preset-react', ['@babel/preset-env', {'modules': false}]],
'plugins': [
'@babel/plugin-proposal-object-rest-spread',
['@babel/plugin-proposal-decorators', { legacy: true }],
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-function-bind'
]
}
module.exports = {
devtool: debug ? 'inline-sourcemap' : null,
entry: './examples/blog/js/main.js',
module: {
loaders: [{
test: /\.js$/,
// NOTE: you need modify exclude regexp when used in separate project
// to allow babel to transpile!!!
// E.g. /node_modules(?!\/react-mobx-admin)/
exclude: /node_modules(?!\/mobx-router)/,
loader: 'babel-loader',
options: babelOptions
}]
},
output: {
path: path.join(__dirname, 'examples/blog'),
filename: 'main.min.js'
},
// NOTE: needed coz' import like from a separate project are used in example
// e.g.: import DataRequester from 'react-mobx-admin/services/requester'
resolve: {
alias: {
'react-mobx-admin': __dirname,
'mobx-router': path.join(__dirname, 'node_modules', 'mobx-router')
}
},
externals: {
'axios': 'axios',
'mobx': 'mobx',
'mobx-react': 'mobxReact',
'react': 'React',
'react-dom': 'ReactDOM'
}
}