-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.server.js
77 lines (71 loc) · 1.83 KB
/
webpack.config.server.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
/* eslint-disable */
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: ['babel-polyfill', './src/server/index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: 'server.bundle.js',
},
target: 'node',
node: {
__filename: true,
__dirname: true,
},
// keep node_module paths out of the bundle
externals: fs
.readdirSync(path.resolve(__dirname, 'node_modules'))
.concat(['react-dom/server', 'react/addons'])
.reduce(function(ext, mod) {
ext[mod] = 'commonjs ' + mod;
return ext;
}, {}),
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, use: ['babel-loader'] },
{
test: /\.svg$/,
use: [
{
loader: 'svg-url-loader',
options: {
noquotes: true,
limit: 8192,
name: path.join('assets', '[name].[hash].[ext]'),
},
},
],
},
{
test: /\.(png|jpg|jpeg|gif|mp4|webm|eot|woff|ttf)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 8192,
name: path.join('assets', '[name].[hash].[ext]'),
},
},
],
},
{ test: /\.css$/, use: ['ignore-loader'] },
],
},
resolve: {
alias: {
app: path.resolve(__dirname, './src/app'),
server: path.resolve(__dirname, './src/server'),
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.REACT_SPINKIT_NO_STYLES': true,
__DEVELOPMENT__: process.env.NODE_ENV !== 'production',
__SERVER__: true,
}),
],
};