refactor: generalize nodeArgs

This commit is contained in:
cha0s 2022-04-04 03:11:40 -05:00
parent 1ade8294a1
commit 976969683f
2 changed files with 5 additions and 16 deletions

View File

@ -8,13 +8,9 @@ export default {
*/
hot: false,
/**
* Whether the Node.js inspector is enabled.
* Arguments to pass along to node. See: https://nodejs.org/api/cli.html
*/
inspect: false,
/**
* Whether Node.js profiling is enabled.
*/
profile: false,
nodeArgs: [],
/**
* Whether to start the server after building.
*/

View File

@ -14,8 +14,7 @@ const {
module.exports = async (flecks) => {
const {
hot,
inspect,
profile,
nodeArgs,
start: isStarting,
} = flecks.get('@flecks/server');
@ -79,14 +78,8 @@ module.exports = async (flecks) => {
options.keyboard = false;
// HMR.
options.signal = !!hot;
// Debugging.
if (inspect) {
options.nodeArgs.push('--inspect');
}
// Profiling.
if (profile) {
options.nodeArgs.push('--prof');
}
// Node args.
options.nodeArgs.push(...nodeArgs);
// Bail hard on unhandled rejections and report.
options.nodeArgs.push('--unhandled-rejections=strict');
options.nodeArgs.push('--trace-uncaught');