2018-03-16 21:03:54 +01:00
|
|
|
const Path = require('path');
|
|
|
|
const nodeExternals = require('webpack-node-externals');
|
2018-03-20 23:57:24 +01:00
|
|
|
const CLIENT_ROOT = Path.resolve(__dirname, 'client/');
|
2018-03-28 01:08:01 +02:00
|
|
|
const CONFIG_ROOT = Path.resolve(__dirname, 'config/');
|
2018-03-20 23:57:24 +01:00
|
|
|
const SERVER_ROOT = Path.resolve(__dirname, 'server/');
|
2018-03-16 21:03:54 +01:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
target: 'node',
|
|
|
|
node : {
|
|
|
|
__dirname: false,
|
|
|
|
},
|
|
|
|
externals: [nodeExternals()],
|
2018-03-20 23:57:24 +01:00
|
|
|
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: [
|
2018-03-20 23:57:24 +01:00
|
|
|
CLIENT_ROOT,
|
2018-03-28 01:08:01 +02:00
|
|
|
CONFIG_ROOT,
|
2018-03-20 23:57:24 +01:00
|
|
|
SERVER_ROOT,
|
2018-03-16 21:03:54 +01:00
|
|
|
'node_modules',
|
|
|
|
__dirname,
|
|
|
|
],
|
|
|
|
extensions: ['.js', '.json', '.jsx', '.css'],
|
|
|
|
},
|
|
|
|
};
|