Merge pull request #2057 from SDA-SE/feat/backend-dev-inspect
feat: support passing --inspect to backend:dev
This commit is contained in:
@@ -25,9 +25,11 @@ export default async (cmd: Command) => {
|
||||
env: 'development',
|
||||
rootPaths: [paths.targetRoot, paths.targetDir],
|
||||
});
|
||||
|
||||
const waitForExit = await serveBackend({
|
||||
entry: 'src/index',
|
||||
checksEnabled: cmd.check,
|
||||
inspectEnabled: cmd.inspect,
|
||||
config: ConfigReader.fromConfigs(appConfigs),
|
||||
appConfigs,
|
||||
});
|
||||
|
||||
@@ -52,6 +52,7 @@ const main = (argv: string[]) => {
|
||||
.command('backend:dev')
|
||||
.description('Start local development server with HMR for the backend')
|
||||
.option('--check', 'Enable type checking and linting')
|
||||
.option('--inspect', 'Enable debugger')
|
||||
.action(lazyAction(() => import('./commands/backend/dev'), 'default'));
|
||||
|
||||
program
|
||||
|
||||
@@ -19,7 +19,11 @@ import { createBackendConfig } from './config';
|
||||
import { resolveBundlingPaths } from './paths';
|
||||
import { ServeOptions } from './types';
|
||||
|
||||
export async function serveBackend(options: ServeOptions) {
|
||||
export async function serveBackend(
|
||||
options: ServeOptions & {
|
||||
inspectEnabled: boolean;
|
||||
},
|
||||
) {
|
||||
const paths = resolveBundlingPaths(options);
|
||||
const config = createBackendConfig(paths, {
|
||||
...options,
|
||||
|
||||
@@ -205,7 +205,10 @@ export function createBackendConfig(
|
||||
: {}),
|
||||
},
|
||||
plugins: [
|
||||
new StartServerPlugin('main.js'),
|
||||
new StartServerPlugin({
|
||||
name: 'main.js',
|
||||
nodeArgs: options.inspectEnabled ? ['--inspect'] : undefined,
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
...(checksEnabled
|
||||
? [
|
||||
|
||||
@@ -25,7 +25,9 @@ export type BundlingOptions = {
|
||||
baseUrl: URL;
|
||||
};
|
||||
|
||||
export type BackendBundlingOptions = Omit<BundlingOptions, 'baseUrl'>;
|
||||
export type BackendBundlingOptions = Omit<BundlingOptions, 'baseUrl'> & {
|
||||
inspectEnabled: boolean;
|
||||
};
|
||||
|
||||
export type ServeOptions = BundlingPathsOptions & {
|
||||
checksEnabled: boolean;
|
||||
|
||||
Reference in New Issue
Block a user