2020-11-30 06:28:29 -06:00
|
|
|
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.*'],
|
|
|
|
}),
|
2020-12-01 15:32:49 -06:00
|
|
|
mocha(),
|
2020-11-30 06:28:29 -06:00
|
|
|
node(),
|
|
|
|
(neutrino) => {
|
|
|
|
neutrino.config
|
|
|
|
.plugin('environment')
|
|
|
|
.use(EnvironmentPlugin, [{
|
|
|
|
SIDE: 'server',
|
|
|
|
}]);
|
2020-12-01 03:20:44 -06:00
|
|
|
neutrino.config
|
|
|
|
.entry('index')
|
|
|
|
.prepend('@latus/core/start');
|
2020-11-30 06:28:29 -06:00
|
|
|
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({
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|