Skip to content

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

Description

πŸ”Ž 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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