34 lines
780 B
JavaScript
34 lines
780 B
JavaScript
const path = require('path');
|
|
|
|
const nodeExternals = require('webpack-node-externals');
|
|
const StartServerPlugin = require('start-server-webpack-plugin');
|
|
|
|
const config = require('./webpack.common.config');
|
|
|
|
config.entry = {
|
|
server: [
|
|
'source-map-support/register',
|
|
'@babel/polyfill',
|
|
path.join(__dirname, 'register-traits.js'),
|
|
'@avocado/behavior/item/initialize',
|
|
path.join(__dirname, 'server', 'index.js'),
|
|
],
|
|
};
|
|
config.externals = [
|
|
nodeExternals({
|
|
whitelist: /@avocado/,
|
|
}),
|
|
];
|
|
const nodeArgs = [];
|
|
if (process.argv.find((arg) => '--prof' === arg)) {
|
|
nodeArgs.push('--prof');
|
|
}
|
|
config.plugins.push(new StartServerPlugin({
|
|
name: 'server.js',
|
|
nodeArgs: nodeArgs,
|
|
restartable: false,
|
|
}));
|
|
config.target = 'node';
|
|
|
|
module.exports = config;
|