-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
51 lines (48 loc) · 1.05 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
const common = {
module: {
rules: [
{
test: /\.worker\.js$/,
exclude: /node_modules/,
loader: 'worker-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['es2015', 'react'],
plugins: ['transform-object-rest-spread'],
cacheDirectory: true
}
}
],
noParse: [
/localforage\.js/
]
}
}
const frontend = Object.assign({}, common, {
devtool: 'cheap-module-source-map',
entry: './src/main.js',
output: {
path: __dirname + '/dist',
publicPath: '/dist/',
filename: 'app.bundle.js'
}
});
const backend = Object.assign({}, common, {
entry: './src/server.js',
output: {
path: __dirname + '/dist',
publicPath: '/dist/',
filename: 'server.js'
},
externals: {
'express': 'commonjs express',
'webpack': 'commonjs webpack',
'webpack-dev-middleware': 'commonjs webpack-dev-middleware'
},
target: 'node'
});
module.exports = [frontend, backend];