Skip to content

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

Open
@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