-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.backend.js
51 lines (49 loc) · 1.04 KB
/
webpack.config.backend.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
import path from 'path'
import fs from 'fs'
import webpack from 'webpack'
const nodeModules = {}
fs.readdirSync('node_modules').
filter(x => ['.bin'].indexOf(x) === -1).
forEach(mod => {
nodeModules[mod] = `commonjs ${mod}`
})
module.exports = {
target: 'node',
entry: [
'webpack/hot/poll?1000',
'babel-polyfill',
'./server/server.js',
],
output: {
path: path.join(__dirname, 'dev'),
filename: 'backend.js',
},
resolve: {
extensions: ['', '.jsx', '.js', '.css'],
},
node: {
__filename: true,
__dirname: false,
},
module: {
loaders: [{
test: /(\.js|\.jsx)$/,
exclude: /(node_modules)/,
loader: 'babel',
}, {
test: /\.(png|jpg|jpeg)$/,
loader: 'url?limit=3072',
}],
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.BannerPlugin('require("source-map-support").install();', {
raw: true,
entryOnly: false,
}),
new webpack.NormalModuleReplacementPlugin(/\.css$/,
path.join(__dirname, 'node_modules/node-noop/index.js')),
],
externals: nodeModules,
devtool: 'source-map',
}