Title: fix(compiler-cli): allow import of modules ending with .js, .ts, etc. by mgechev · Pull Request #14664 · angular/angular · GitHub
Open Graph Title: fix(compiler-cli): allow import of modules ending with .js, .ts, etc. by mgechev · Pull Request #14664 · angular/angular
X Title: fix(compiler-cli): allow import of modules ending with .js, .ts, etc. by mgechev · Pull Request #14664 · angular/angular
Description: Fix #14663 Allow importing node modules which name ends with the strings: .ts, .d, .ts, .js, .jsx, .tsx. According to microsoft/TypeScript#4595 TypeScript knows how to handle imports with an extension so relative imports should not be a problem (as shown in the tests). If you prefer to keep the replace, another, alternative solution (less clean I suppose) is: moduleNameToFileName(m: string, containingFile: string): string|null { // ... const original = m; m = m.replace(EXT, ''); const resolve = (m: string) => ts.resolveModuleName( m, containingFile.replace(/\\/g, '/'), this.options, this.resolveModuleNameHost) .resolvedModule; let resolved = resolve(m); if (!resolved) { resolved = resolve(original); } return resolved ? this.getCanonicalFileName(resolved.resolvedFileName) : null; }; Please check if the PR fulfills these requirements The commit message follows our guidelines: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit Tests for the changes have been added (for bug fixes / features) Docs have been added / updated (for bug fixes / features) What kind of change does this PR introduce? (check one with "x") [x] Bugfix [ ] Feature [ ] Code style update (formatting, local variables) [ ] Refactoring (no functional changes, no api changes) [ ] Build related changes [ ] CI related changes [ ] Other... Please describe: What is the current behavior? (You can also link to an open issue here) AoT doesn't allows import of package names ending with .js, .ts, etc. What is the new behavior? AoT allows import of package names ending with .js, .ts, etc. Does this PR introduce a breaking change? (check one with "x") [ ] Yes [x] No
Open Graph Description: Fix #14663 Allow importing node modules which name ends with the strings: .ts, .d, .ts, .js, .jsx, .tsx. According to microsoft/TypeScript#4595 TypeScript knows how to handle imports with an extens...
X Description: Fix #14663 Allow importing node modules which name ends with the strings: .ts, .d, .ts, .js, .jsx, .tsx. According to microsoft/TypeScript#4595 TypeScript knows how to handle imports with an extens...
Opengraph URL: https://github.com/angular/angular/pull/14664
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f5e7397c-09fe-7764-fe54-2e390cea84c6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C3B8:113BF0:44ECE9:5F2FCA:6B049ED1 |
| html-safe-nonce | 7d8a1d628e6f4c9aac28af1fffb12678bcd6c9e3808f6e11282e37e106ab0891 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0I4OjExM0JGMDo0NEVDRTk6NUYyRkNBOjZCMDQ5RUQxIiwidmlzaXRvcl9pZCI6IjQ0NTYzMDkxMTQzNjQyNzIzMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3cad5133c55008c819dacdf6862c916204624c79470256ce21abe642bfc370a2 |
| hovercard-subject-tag | pull_request:107549760 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/angular/angular/pull/14664/files |
| twitter:image | https://avatars.githubusercontent.com/u/455023?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/455023?s=400&v=4 |
| og:image:alt | Fix #14663 Allow importing node modules which name ends with the strings: .ts, .d, .ts, .js, .jsx, .tsx. According to microsoft/TypeScript#4595 TypeScript knows how to handle imports with an extens... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3fd14143b75b2af7b76bbd23b069867d091adfcc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width