Skip to content

rewriteRelativeImportExtensions does not rewrite the extension for an import expressions unless the file is detected to be a moduleย #60599

@bradzacher

Description

@bradzacher

๐Ÿ”Ž Search Terms

rewriteRelativeImportExtensions, import expression

๐Ÿ•— Version & Regression Information

  • This changed between versions 5.7

โฏ Playground Link

https://www.typescriptlang.org/play/?rewriteRelativeImportExtensions=true#code/PTAEEsFsAcHsCcAuoDkA6YAzWs2IM4oDcAsAFBRxIAU6WOehAlOUA

๐Ÿ’ป Code

Test One

import('./foo.ts')

Test Two

import './foo.ts';
import('./foo.ts')

๐Ÿ™ Actual behavior

JS Output

Test One

import('./foo.ts') // โŒ

Test Two

import './foo.js'; // โœ…
import('./foo.js') // โœ…

๐Ÿ™‚ Expected behavior

JS Output

Test One

import('./foo.js') // โœ…

Test Two

import './foo.js'; // โœ…
import('./foo.js') // โœ…

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions