60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
require('dotenv/config');
|
|
|
|
const airbnbBase = require('@neutrinojs/airbnb-base');
|
|
const clean = require('@neutrinojs/clean');
|
|
const mocha = require('@neutrinojs/mocha');
|
|
const node = require('@neutrinojs/node');
|
|
const {EnvironmentPlugin} = require('webpack');
|
|
const nodeExternals = require('webpack-node-externals');
|
|
|
|
module.exports = {
|
|
options: {
|
|
root: __dirname,
|
|
},
|
|
use: [
|
|
airbnbBase({
|
|
eslint: {
|
|
cache: false,
|
|
baseConfig: require('./.eslint.defaults'),
|
|
},
|
|
}),
|
|
clean({
|
|
cleanOnceBeforeBuildPatterns: ['**/*.hot-update.*'],
|
|
}),
|
|
mocha(),
|
|
node(),
|
|
(neutrino) => {
|
|
neutrino.config
|
|
.plugin('environment')
|
|
.use(EnvironmentPlugin, [{
|
|
SIDE: 'server',
|
|
}]);
|
|
neutrino.config
|
|
.entry('index')
|
|
.prepend('@latus/core/start');
|
|
if ('production' !== neutrino.config.get('mode')) {
|
|
neutrino.config
|
|
.entry('index')
|
|
.prepend('dotenv/config');
|
|
neutrino.config
|
|
.plugin('start-server')
|
|
.tap((args) => {
|
|
const options = args[0];
|
|
const inspectArg = process.argv.find((arg) => -1 !== arg.indexOf('--inspect'));
|
|
if (inspectArg) {
|
|
options.nodeArgs.push(inspectArg);
|
|
}
|
|
const profArg = process.argv.find((arg) => -1 !== arg.indexOf('--prof'));
|
|
if (profArg) {
|
|
options.nodeArgs.push(profArg);
|
|
}
|
|
return args;
|
|
});
|
|
}
|
|
neutrino.config
|
|
.externals(nodeExternals({
|
|
}));
|
|
},
|
|
],
|
|
};
|