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.resolve.modules .add(neutrino.options.source); neutrino.config.resolve.modules .add(`${neutrino.options.source}/../node_modules`); if (process.env.LATUS_LINTING) { return; } neutrino.config.module .rule('compile') .use('babel') .get('options').plugins.push( [ 'babel-plugin-webpack-alias', { config: `${__dirname}/webpack.config.js`, }, ], ); 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({ })); }, ], };