Skip to content

Commit

Permalink
fix(web): refactor line to add a guard instead for easier readability
Browse files Browse the repository at this point in the history
When a typescript webpack config file is provided as an option for the web build executor `nx
run
project:serve` will not fail because the file type is typescript.
ISSUES CLOSED: nrwl#7454
  • Loading branch information
ndcunningham committed Nov 5, 2021
1 parent aa59fdc commit 4104239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"terser": "4.3.8",
"terser-webpack-plugin": "^5.1.1",
"ts-loader": "^9.2.6",
"ts-node": "~9.1.1",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "3.4.1",
"tslib": "^2.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/web/src/utils/webpack/tsNodeRegister.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function tsNodeRegister(file: string = '', tsConfig?: string) {
if (file && file.endsWith('.ts')) {
if (!file?.endsWith('.ts')) return;
// Register TS compiler lazily
require('ts-node').register({
project: tsConfig,
Expand All @@ -16,5 +16,4 @@ export function tsNodeRegister(file: string = '', tsConfig?: string) {
if (baseUrl && paths) {
tsconfigPaths.register({ baseUrl, paths });
}
}
}

0 comments on commit 4104239

Please sign in to comment.