Skip to content

Commit

Permalink
feat(): add built-in source maps support
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jul 7, 2021
1 parent 0aea933 commit 499ac3f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions actions/start.action.ts
Expand Up @@ -43,9 +43,8 @@ export class StartAction extends BuildAction {
const binaryToRun =
binaryToRunOption && (binaryToRunOption.value as string | undefined);

const { options: tsOptions } = this.tsConfigProvider.getByConfigFilename(
pathToTsconfig,
);
const { options: tsOptions } =
this.tsConfigProvider.getByConfigFilename(pathToTsconfig);
const outDir = tsOptions.outDir || defaultOutDir;
const onSuccess = this.createOnSuccessHook(
configuration,
Expand Down Expand Up @@ -146,9 +145,21 @@ export class StartAction extends BuildAction {
typeof debug === 'string' ? `--inspect=${debug}` : '--inspect';
processArgs.unshift(inspectFlag);
}
if (this.isSourceMapSupportPkgAvailable()) {
processArgs.unshift('-r source-map-support/register');
}
return spawn(binaryToRun, processArgs, {
stdio: 'inherit',
shell: true,
});
}

private isSourceMapSupportPkgAvailable() {
try {
require.resolve('source-map-support');
return true;
} catch {
return false;
}
}
}
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -58,6 +58,7 @@
"os-name": "4.0.0",
"rimraf": "3.0.2",
"shelljs": "0.8.4",
"source-map-support": "0.5.19",
"tree-kill": "1.2.2",
"tsconfig-paths": "3.10.1",
"tsconfig-paths-webpack-plugin": "3.5.1",
Expand Down

0 comments on commit 499ac3f

Please sign in to comment.