spee.ch/webpack.server.common.js
2018-03-19 14:11:05 -07:00

43 lines
969 B
JavaScript

const Path = require('path');
const nodeExternals = require('webpack-node-externals');
const CLIENT_ROOT = Path.resolve(__dirname, 'client/');
module.exports = {
target: 'node',
node : {
__dirname: false,
},
externals: [nodeExternals()],
entry : ['babel-polyfill', 'whatwg-fetch', './server/server.js'],
output : {
path : Path.join(__dirname, 'server/'),
publicPath : 'server/',
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: [
CLIENT_ROOT,
'node_modules',
__dirname,
],
extensions: ['.js', '.json', '.jsx', '.css'],
},
};