-
Notifications
You must be signed in to change notification settings - Fork 4
Interest check: package maps #173
Description
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.