-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
88 lines (76 loc) · 1.63 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const webpack = require('webpack')
const path = require('path')
const WebpackShellPlugin = require('webpack-shell-plugin');
const SRC = path.resolve(__dirname, 'src')
const DIST = path.resolve(__dirname, 'dist')
var reactConfig = {
entry: [
'react-hot-loader/patch',
'./src/main.js'
],
output: {
path: DIST,
filename: 'app.bundle.js'
},
devServer: {
inline: true, // Hot reloading
port: 8081, // Port which the Dev Server will listen on
contentBase: './', // Where the entry to your app is
open: true // Open site in new browser tab upon command execution
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'file-loader?name=[name].[ext]'
},
{
test: /\.css$/,
loader: 'file-loader?name=[name].[ext]'
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
plugins: [
new webpack.NamedModulesPlugin(),
new WebpackShellPlugin({
onBuildStart: ['echo reactConfig Starting'],
onBuildEnd: ['echo reactConfig Ending']
})
]
}
var bffConfig = {
target: 'node',
node: {
__dirname: false,
},
entry: [
'./src/server.js'
],
output: {
path: DIST,
filename: 'server.bundle.js'
},
module: {
loaders: [
{
test: /\.html$/,
loader: 'file-loader?name=[name].[ext]'
},
{
test: /\.css$/,
loader: 'file-loader?name=[name].[ext]'
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
}
module.exports = [reactConfig, bffConfig]