spee.ch/webpack.package.common.js

46 lines
1 KiB
JavaScript
Raw Normal View History

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