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