Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit ee44e2d

Browse files
committed
fix: update normalize-path to use ECMAScript compliant default import
The `normalize-path` package was previously imported via a namespace import. However, the ECMAScript specification returns an exotic namespace object from namespace imports which can never be a function. As a result a namespace import can not be called. Since the import is directly called it must be imported As a default import to be ECMAScript compliant. TypeScript by default allows the non-compliant form even though it can result in runtime errors. The TypeScript `esModuleInterop` option (recommended by TypeScript) causes TypeScript to error on non-compliant usage and ensures the correct code is emitted so that the code can be executed and/or bundled in an ESM environment.
1 parent 3b4f58d commit ee44e2d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/app/shared/normalize-path.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as normalize from 'path-normalize';
1+
import normalize from 'path-normalize';
22

33
/**
44
* Normalizes the given path by:

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"declaration": false,
99
"downlevelIteration": true,
1010
"experimentalDecorators": true,
11+
"esModuleInterop": true,
1112
"module": "es2020",
1213
"moduleResolution": "node",
1314
"importHelpers": true,

0 commit comments

Comments
 (0)