-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.dev.js
98 lines (97 loc) · 2.25 KB
/
webpack.config.dev.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/* eslint-disable */
var nodeExternals = require('webpack-node-externals');
var path = require('path');
module.exports = [
/**
* Client
*/
{
entry: './src/client/index.js',
devtool: 'inline-source-map',
output: {
filename: './public/bundle.js'
},
resolve: {
/**
* Allows us to do stuff like `import thing from 'app/thing'`, which would
* import from `/src/client/app/thing`
*/
modules: ['node_modules', './src/client'],
/**
* Overriding the default to allow jsx to be resolved automatically.
*/
extensions: ['.js', '.json', '.jsx'],
/**
* Access config from anywhere via `import settings from 'settings'``
*/
alias: {
settings: path.resolve(__dirname, './settings.js')
}
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react', 'stage-2']
}
}
]
}
},
/**
* Server
*
* This is used purely as a way to run the server code through babel, and not to bundle any
* external dependencies.
*/
{
entry: './src/server/index.js',
/**
* XXX For some reasn source maps only work correctly in node debugger when using inline
* source map.
*/
devtool: 'inline-source-map',
/**
* Ignore built-in node modules like path, fs, etc.
*/
target: 'node',
/**
* Webpack causes __dirname and __filename to return undefined. This fixes it.
* info: https://github.com/webpack/webpack/issues/1599
*/
node: {
__dirname: false,
__filename: false
},
/**
* Ignore anything in node_modules
*/
externals: [nodeExternals()],
output: {
filename: './server.js'
},
resolve: {
modules: ['./src/server'],
/**
* Access config from anywhere via `import settings from 'settings'``
*/
alias: {
settings: path.resolve(__dirname, './settings.js')
}
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'stage-2']
}
}
]
}
}
]