spee.ch/webpack.package.common.js

48 lines
1.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/');
2018-03-28 01:08:01 +02:00
const CONFIG_ROOT = Path.resolve(__dirname, 'config/');
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,
2018-03-28 01:08:01 +02:00
CONFIG_ROOT,
SERVER_ROOT,
2018-03-16 21:03:54 +01:00
'node_modules',
__dirname,
],
extensions: ['.js', '.json', '.jsx', '.css'],
},
};