humus-old/webpack.server.config.js

44 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-03-20 15:28:18 -05:00
const path = require('path');
2019-04-20 14:16:06 -05:00
const webpack = require('webpack');
2019-03-20 15:28:18 -05:00
const nodeExternals = require('webpack-node-externals');
const StartServerPlugin = require('start-server-webpack-plugin');
const config = require('./webpack.common.config');
2019-04-22 13:08:45 -05:00
config.devtool = 'inline-source-map';
2019-03-20 15:28:18 -05:00
config.entry = {
server: [
2019-04-20 14:16:06 -05:00
'webpack/hot/signal',
2019-03-20 15:28:18 -05:00
'source-map-support/register',
'@babel/polyfill',
2019-04-14 21:32:48 -05:00
path.join(__dirname, 'register-packets.js'),
'@avocado/behavior/item/initialize',
path.join(__dirname, 'server', 'index.js'),
2019-03-20 15:28:18 -05:00
],
};
config.externals = [
nodeExternals({
2019-04-20 14:16:06 -05:00
whitelist: /(?:@avocado|webpack\/hot\/signal)/,
2019-03-20 15:28:18 -05:00
}),
];
2019-04-14 20:39:27 -05:00
config.module.rules[1].use.options.paths.push(
path.resolve(__dirname, 'server'),
);
2019-04-14 21:32:48 -05:00
config.module.rules[2].use.options.paths.push(
path.resolve(__dirname, 'server'),
);
2019-04-12 13:44:56 -05:00
const nodeArgs = [];
if (process.argv.find((arg) => '--prof' === arg)) {
nodeArgs.push('--prof');
}
2019-03-20 15:28:18 -05:00
config.plugins.push(new StartServerPlugin({
name: 'server.js',
2019-04-12 13:44:56 -05:00
nodeArgs: nodeArgs,
2019-04-20 14:16:06 -05:00
signal: true,
2019-03-20 15:28:18 -05:00
}));
2019-04-20 14:16:06 -05:00
2019-03-20 15:28:18 -05:00
config.target = 'node';
module.exports = config;