Merge pull request #7438 from AmericanAirlines/node-inspect-break-debugging
Add inspectBrk to try to use when debugging backend node
This commit is contained in:
@@ -29,6 +29,7 @@ export default async (cmd: Command) => {
|
||||
entry: 'src/index',
|
||||
checksEnabled: cmd.check,
|
||||
inspectEnabled: cmd.inspect,
|
||||
inspectBrkEnabled: cmd.inspectBrk,
|
||||
});
|
||||
|
||||
await waitForExit();
|
||||
|
||||
@@ -69,6 +69,7 @@ export function registerCommands(program: CommanderStatic) {
|
||||
.description('Start local development server with HMR for the backend')
|
||||
.option('--check', 'Enable type checking and linting')
|
||||
.option('--inspect', 'Enable debugger')
|
||||
.option('--inspect-brk', 'Enable debugger with await to attach debugger')
|
||||
// We don't actually use the config in the CLI, just pass them on to the NodeJS process
|
||||
.option(...configOption)
|
||||
.action(lazy(() => import('./backend/dev').then(m => m.default)));
|
||||
|
||||
@@ -247,6 +247,13 @@ export async function createBackendConfig(
|
||||
|
||||
const { loaders } = transforms(options);
|
||||
|
||||
const runScriptNodeArgs = new Array<string>();
|
||||
if (options.inspectEnabled) {
|
||||
runScriptNodeArgs.push('--inspect');
|
||||
} else if (options.inspectBrkEnabled) {
|
||||
runScriptNodeArgs.push('--inspect-brk');
|
||||
}
|
||||
|
||||
return {
|
||||
mode: isDev ? 'development' : 'production',
|
||||
profile: false,
|
||||
@@ -319,7 +326,7 @@ export async function createBackendConfig(
|
||||
plugins: [
|
||||
new RunScriptWebpackPlugin({
|
||||
name: 'main.js',
|
||||
nodeArgs: options.inspectEnabled ? ['--inspect'] : undefined,
|
||||
nodeArgs: runScriptNodeArgs.length > 0 ? runScriptNodeArgs : undefined,
|
||||
args: process.argv.slice(3), // drop `node backstage-cli backend:dev`
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
|
||||
@@ -47,11 +47,13 @@ export type BackendBundlingOptions = {
|
||||
isDev: boolean;
|
||||
parallel?: ParallelOption;
|
||||
inspectEnabled: boolean;
|
||||
inspectBrkEnabled: boolean;
|
||||
};
|
||||
|
||||
export type BackendServeOptions = BundlingPathsOptions & {
|
||||
checksEnabled: boolean;
|
||||
inspectEnabled: boolean;
|
||||
inspectBrkEnabled: boolean;
|
||||
};
|
||||
|
||||
export type LernaPackage = {
|
||||
|
||||
Reference in New Issue
Block a user