Merge pull request #2057 from SDA-SE/feat/backend-dev-inspect

feat: support passing --inspect to backend:dev
This commit is contained in:
Raghunandan Balachandran
2020-08-25 15:12:00 +02:00
committed by GitHub
5 changed files with 15 additions and 3 deletions
+2
View File
@@ -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,
});
+1
View File
@@ -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
+5 -1
View File
@@ -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,
+4 -1
View File
@@ -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
? [
+3 -1
View File
@@ -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;