-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.server.js
62 lines (58 loc) · 1.5 KB
/
webpack.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
var webpack = require('webpack');
var path = require('path');
var fs = require('fs');
var plugins = require('./webpack/plugins.js').slice()
var loaders = require('./webpack/loaders.js').slice()
var postcss = require('./webpack/postcss.js')
var nodeModules = {};
fs.readdirSync('node_modules')
.filter(function(x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function(mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
plugins.push(
new webpack.DefinePlugin({"process.env": {NODE_ENV: '"production"'}}),
new webpack.DefinePlugin({__CLIENT__: false, __SERVER__: true}),
new webpack.BannerPlugin('require("source-map-support").install();', { raw: true, entryOnly: false })
)
loaders.push(
{
include: /\.(js|jsx)$/,
loaders: ["babel-loader?stage=0&optional=runtime&plugins=typecheck"]
},
{
include: /\.css$/,
loaders: [
"css/locals?modules&importLoaders=1&localIdentName=[path]__[local]___[hash:base64:5]",
"postcss-loader"
],
}
)
module.exports = {
entry: './Frontend/Routes',
target: 'node',
output: {
path: path.join(__dirname, 'Backend/public/build'),
filename: 'routeBundle.js',
libraryTarget: 'commonjs2'
},
externals: nodeModules,
plugins: plugins,
postcss: postcss,
module: {
loaders: loaders
},
resolve: {
modulesDirectories: [
'node_modules',
'./Frontend',
'./Frontend/assets',
'./Backend',
'_shared'
],
extensions: ["", ".json", ".js", ".jsx", ".css"]
},
devtool: 'sourcemap'
}