forked from faceyspacey/redux-first-router-demo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathserver.dev.js
76 lines (72 loc) · 1.82 KB
/
server.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
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const statsOptions = require('./stats.config')
const res = p => path.resolve(__dirname, p)
// if you're specifying externals to leave unbundled, you need to tell Webpack
// to still bundle `react-universal-component`, `webpack-flush-chunks` and
// `require-universal-module` so that they know they are running
// within Webpack and can properly make connections to client modules:
const externals = fs
.readdirSync(res('../node_modules'))
.filter(
x =>
!/\.bin|react-universal-component|require-universal-module|webpack-flush-chunks/.test(
x
)
)
.reduce((externals, mod) => {
externals[mod] = `commonjs ${mod}`
return externals
}, {})
module.exports = {
name: 'server',
target: 'node',
devtool: 'source-map',
entry: ['babel-polyfill', 'fetch-everywhere', res('../server/render.js')],
externals,
output: {
path: res('../buildServer'),
filename: '[name].js',
libraryTarget: 'commonjs2',
publicPath: '/static/',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader',
},
{
test: /\.css$/,
exclude: /node_modules/,
use: {
loader: 'css-loader/locals',
options: {
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]',
},
},
},
{
test: /\.sol$/,
loader: ['web3-loader', 'solc-loader'],
},
],
},
resolve: {
extensions: ['.js', '.css'],
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
},
}),
],
stats: statsOptions,
}