Skip to content

Module Resolution: allow subpath imports that start with #/Β #62841

@Boshen

Description

@Boshen

πŸ” Search Terms

module resolution package imports

βœ… Viability Checklist

⭐ Suggestion

See nodejs/node#60864

πŸ“ƒ Motivating Example

This allows us to define symmetric exports and imports field in package.json:

{
  "exports": {
    "./*": "./src/*"
  },
  "imports": {
    "#/*": "./src/*"
  }
}

and allows us to migrate away from compilerOptions.paths.

πŸ’» Use Cases

See above

The code requires changing is

if (moduleName === "#" || startsWith(moduleName, "#/")) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions