Skip to content

Relax package.json#imports prefix #49182

Closed as not planned
Closed as not planned
@bmeck

Description

@bmeck

What is the problem this feature will solve?

Tools such as rspack, bun, typescript, remix, and turbo are all looking at using tsconfig.json#compilerOptions.paths . This is in part due to constraints on package.json#imports and it lacking the ability to fully alias the entire import space. These also seem to have differing constraints and some are doing something outside the standard TS behavior on purpose.

What is the feature you are proposing to solve the problem?

The package.json#imports field seems sufficient from reading some twitter threads involving a few maintainers from remix or rspack except for the prefix # constraint. I propose getting feedback from these tools on removing the constraint if that would be sufficient for their users’ general needs. If it is sufficient we could encourage people to use a single way of doing this allowing tooling to avoid divergence and interop woes.

This would not cover global aliasing which already can be covered with policy redirects but likely is not desirable/sufficient for some subset of users. My hope is that subset is small enough to avoid the issue blocking this entirely.

What alternatives have you considered?

Supporting tsconfig.json in a limited subset to alleviate the user needs.

cc @nodejs/loaders @nodejs/modules

Metadata

Metadata

Assignees

No one assigned

    Labels

    esmIssues and PRs related to the ECMAScript Modules implementation.feature requestIssues that request new features to be added to Node.js.moduleIssues and PRs related to the module subsystem.stale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions