This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
69 lines (68 loc) · 1.7 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: './mobx-react-todomvc/src/client',
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(process.env.NODE_ENV) },
__CLIENT__: JSON.stringify(true),
__SERVER__: JSON.stringify(false),
__TARGET__: JSON.stringify('browser'),
}),
],
resolve: {
alias: {
mobx: path.resolve(__dirname, './mobx/src/mobx.ts'),
'mobx-react': path.resolve(__dirname, './mobx-react/src'),
'mobx-react-devtools': path.resolve(__dirname, './mobx-react-devtools/src')
},
extensions: ['.js', '.jsx', '.ts']
},
externals: {
'react-native': {
root: 'ReactNative',
commonjs: 'react-native',
commonjs2: 'react-native',
amd: 'react-native'
},
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css/locals?module'
},
{
test: /\.svg$/,
loader: 'url-loader'
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
include: /(mobx-react-devtools)/,
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /(node_modules|mobx-react-devtools)/,
query: {
presets: ['es2015', 'react'],
plugins: ['transform-decorators-legacy', 'transform-class-properties'],
}
},
{
test: /\.tsx?$/,
exclude: /(node_modules)/,
loader: 'ts-loader',
}
],
},
};