2018-03-16 21:03:54 +01:00
|
|
|
const Path = require('path');
|
|
|
|
const nodeExternals = require('webpack-node-externals');
|
2018-03-19 22:11:05 +01:00
|
|
|
const CLIENT_ROOT = Path.resolve(__dirname, 'client/');
|
2018-03-16 21:03:54 +01:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
target: 'node',
|
|
|
|
node : {
|
|
|
|
__dirname: false,
|
|
|
|
},
|
|
|
|
externals: [nodeExternals()],
|
2018-03-19 22:11:05 +01:00
|
|
|
entry : ['babel-polyfill', 'whatwg-fetch', './server/server.js'],
|
2018-03-16 21:03:54 +01:00
|
|
|
output : {
|
2018-03-19 22:11:05 +01:00
|
|
|
path : Path.join(__dirname, 'server/'),
|
|
|
|
publicPath : 'server/',
|
2018-03-16 21:03:54 +01:00
|
|
|
filename : 'index.js',
|
|
|
|
library : '',
|
|
|
|
libraryTarget: 'commonjs-module',
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test : /.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loader : 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: ['es2015', 'react', 'stage-2'],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test : /.css$/,
|
|
|
|
loader: 'css-loader',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
modules: [
|
2018-03-19 22:11:05 +01:00
|
|
|
CLIENT_ROOT,
|
2018-03-16 21:03:54 +01:00
|
|
|
'node_modules',
|
|
|
|
__dirname,
|
|
|
|
],
|
|
|
|
extensions: ['.js', '.json', '.jsx', '.css'],
|
|
|
|
},
|
|
|
|
};
|