Commit 6adc892
Fix TypeScript import detection for files with dots in name
Fixed issue where TypeScript files with dots in their names (e.g., abstract.helper.ts) were not being detected and transpiled when imported without extension. The problem was that path.extname() would consider the last dot as a file extension.
Now the transpiler:
- Checks if an import has a standard module extension (.js, .mjs, .cjs, .json, .node)
- If not, tries adding .ts extension to find and transpile TypeScript files
- This correctly handles files like abstract.helper.ts, material.component.helper.ts, etc.
Added test case to verify this scenario works correctly.
Co-authored-by: kobenguyent <7845001+kobenguyent@users.noreply.github.com>1 parent 37878c1 commit 6adc892
File tree
4 files changed
+40
-2
lines changed- lib/utils
- test
- data/typescript-support
- unit
4 files changed
+40
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
146 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
389 | 406 | | |
390 | 407 | | |
0 commit comments