98 lines
2.6 KiB
JavaScript
98 lines
2.6 KiB
JavaScript
require('dotenv/config');
|
|
|
|
const airbnb = require('@neutrinojs/airbnb');
|
|
const clean = require('@neutrinojs/clean');
|
|
const copy = require('@neutrinojs/copy');
|
|
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: [
|
|
(neutrino) => {
|
|
neutrino.options.mains.electron = {entry: './src/electron'};
|
|
},
|
|
airbnb({
|
|
eslint: {
|
|
cache: false,
|
|
baseConfig: require('./.eslint.defaults'),
|
|
},
|
|
}),
|
|
clean({
|
|
cleanOnceBeforeBuildPatterns: ['**/*.hot-update.*'],
|
|
}),
|
|
copy({
|
|
patterns: [{
|
|
from: 'src/assets',
|
|
to: 'http',
|
|
}],
|
|
}),
|
|
mocha(),
|
|
node(),
|
|
(neutrino) => {
|
|
[
|
|
'components',
|
|
'context',
|
|
'fonts',
|
|
'hooks',
|
|
'images',
|
|
'scss',
|
|
].forEach((path) => {
|
|
neutrino.config.resolve.alias
|
|
.set(path, `${neutrino.options.source}/react/${path}`);
|
|
});
|
|
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);
|
|
}
|
|
options.nodeArgs.push('--experimental-repl-await');
|
|
options.nodeArgs.push('--unhandled-rejections=strict');
|
|
return args;
|
|
});
|
|
}
|
|
neutrino.config.externals(nodeExternals());
|
|
neutrino.config.resolve.alias
|
|
.set('pixi.js', 'pixi.js-legacy')
|
|
.set('react-dom', '@hot-loader/react-dom');
|
|
},
|
|
],
|
|
};
|