Skip to content

Interest check: package maps #173

@arcanis

Description

@arcanis

Hi folks,

I recently opened nodejs/node#62239, which implements a --experimental-package-map flag for Node.js. The short version: it lets runtimes resolve packages from a static JSON file instead of walking node_modules, giving package managers a standard way to express strict dependency boundaries and eliminate phantom dependencies.

The format is intentionally minimal - a flat map of package IDs to paths and allowed dependencies:

{
  "packages": {
    "my-app": {
      "path": "./src",
      "dependencies": {
        "react": "react@19"
      }
    },
    "react@19": {
      "path": "./node_modules/react"
    }
  }
}

During review, the question came up of whether this should go through a standards process so other runtimes can implement it too - rather than being a Node.js-only thing that others later have to play catch-up with.

I intentionally diverged from the import maps spec (the imports/scopes structure doesn't map well to the package-level semantics needed here), but I'm very open to aligning where possible or pursuing a complementary spec if there's appetite for it.

Would TC55 members be interested in discussing this? Happy to write up a more formal explainer or join a call if that's useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions