forked from danielstern/isomorphic-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.babel.js
80 lines (79 loc) · 2.47 KB
/
webpack.config.dev.babel.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
import webpack from 'webpack';
import path from 'path';
/**
* Development webpack config designed to be loaded by express development server
*/
export default {
/**
* The scripts in entry are combined in order to create our bundle
*/
entry: [
/**
* Webpack hot middleware enables hot reloading.
* reload?true causes the page to reload when no hot reload handler is specified
*/
'webpack-hot-middleware/client?reload=true',
/**
* babel-regenerator-runtime lets us use generators and yield
*/
'babel-regenerator-runtime',
/**
* The entry point of the main application
*/
path.resolve(__dirname, 'src/')
],
/**
* Output contains detailed information about the bundle.js
* In this case, bundle.js is never created but server by webpack-dev-middleware in ./server
*/
output: {
path: path.resolve(__dirname, 'public'),
/**
* Public path is necessary for webpack HMR to reload correctly when on a path other than '/'
*/
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
/**
* Needed for Hot module reloading
*/
new webpack.HotModuleReplacementPlugin(),
/**
* Causes the relative path of the module to be used in HMR
* Recommended by docs for development configurations: https://webpack.js.org/plugins/named-modules-plugin/
*/
new webpack.NamedModulesPlugin(),
/**
* Defines the env as 'development', which triggers different behaviors in some scripts
* To see more, search project for 'development'
*/
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
WEBPACK: true
}
})
],
/**
* Resolve allows files to be imported without specifying an extension as long as they match one specified, i.e.
* import component from './component'
*/
resolve: {
extensions: ['.js', '.json', '.jsx'],
},
module: {
loaders: [
{
/**
* Babel loader is used for any JS or JSX files in the src directory
*/
test: /\.jsx?/,
use: {
loader: 'babel-loader'
},
include: path.resolve(__dirname, 'src'),
},
]
}
}