egoist / egoist/tsup

Support `rewriteRelativeImportExtensions` (TS 5.7+)

Open
#1,271 0 comments 9 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

TS 5.7 introduced the new `rewriteRelativeImportExtensions` option, which allows devs to write imports with `.ts` extensions, and it'll be transformed to `.js` extensions at compile time. Despite having the option set, tsup doesn't do the rewrites. Ideally it would rewrite the extension according to the module type emitted. e.g. esm with `mjs` extensions would rewrite the relative import extension to `mjs`.

Ref: https://devblogs.microsoft.com/typescript/announcing-typescript-5-7/#path-rewriting-for-relative-paths

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by reading the TypeScript 5.7 path-rewriting reference and tracing tsup's handling of TypeScript options and emitted module extensions. Done means relative imports using .ts extensions are rewritten to the appropriate emitted extension, including mjs for the stated ESM case.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.