spee.ch/webpack.server.common.js

44 lines
969 B
JavaScript
Raw Normal View History

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()],
entry : ['babel-polyfill', 'whatwg-fetch', './server/server.js'],
2018-03-16 21:03:54 +01:00
output : {
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'],
},
};