Skip to content

module: add --experimental-strip-private-modules #63869

Open
marco-ippolito wants to merge 2 commits into
nodejs:mainfrom
marco-ippolito:strip-private-node-modules
Open

module: add --experimental-strip-private-modules #63869
marco-ippolito wants to merge 2 commits into
nodejs:mainfrom
marco-ippolito:strip-private-node-modules

Conversation

@marco-ippolito

@marco-ippolito marco-ippolito commented Jun 12, 2026

Copy link
Copy Markdown
Member

Followup of #63853
Adds a flag to allow type stripping inside node_modules ONLY if private.
I think I covered #63853 (comment) concerns about smuggling private package.json's in a non private package

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/config
  • @nodejs/loaders
  • @nodejs/typescript

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 12, 2026
@marco-ippolito marco-ippolito force-pushed the strip-private-node-modules branch 2 times, most recently from 003fda2 to 88c3881 Compare June 12, 2026 09:02

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marco-ippolito marco-ippolito force-pushed the strip-private-node-modules branch from 88c3881 to 5c48075 Compare June 12, 2026 12:27
@marco-ippolito marco-ippolito added the blocked PRs that are blocked by other issues or PRs. label Jun 12, 2026
@marco-ippolito

Copy link
Copy Markdown
Member Author

Adding the blocked label to make sure @nodejs/typescript reviews and agrees with this change

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aduh95 aduh95 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's worth it, also I don't think that we can use private to reliably guess if a package was downloaded from a registry or not, and it adds arguably a lot of complexity (in comparison for e.g. adding a loader, or not putting the code inside node_modules)

Comment thread doc/api/packages.md Outdated
Comment thread doc/api/packages.md Outdated
@RyanCavanaugh

Copy link
Copy Markdown

Weighing in from the TypeScript team: We're OK with this, and don't have any concerns about this eventually going unflagged either.

That said, we wanted to re-emphasize @ljharb's and others' comments in the prior PR thread. Our top priority in this space remains ensuring that un-compiled .ts is never the entry point for a package in the public registry. The fundamental technical motivations behind that haven't changed, and we don't see any path forward where they could change.

Keeping this restricted to private: true is a great compromise that enables that goal while still making monorepo dev/deploy more straightforward, we just want to have absolute clarity and consensus that this is not a stepping stone to enable type stripping of public registry packages.

@marco-ippolito marco-ippolito force-pushed the strip-private-node-modules branch 2 times, most recently from 9f68ed3 to 2cfa6d1 Compare June 12, 2026 16:51
@marco-ippolito marco-ippolito added strip-types Issues or PRs related to strip-types support and removed blocked PRs that are blocked by other issues or PRs. labels Jun 12, 2026
@marco-ippolito

Copy link
Copy Markdown
Member Author

we just want to have absolute clarity and consensus that this is not a stepping stone to enable type stripping of public registry packages.

To be explicit for @nodejs/typescript: this is not a stepping stone to public-registry TS.
I have it documented as a non goal
https://github.com/nodejs/node/pull/63869/changes#diff-7349c17bce4d97526eefcb6f8291d617e7edb92ed9927fd3b9264e8014fc4e7cR1423

@aduh95 I kindly ask you to reconsider.
The design relies on the contract that registries refuse to publish a "private": true root.
Im sure there are a million ways to work around that, but for the vast majority of people it doesn't matter.
And just like people didnt want to run TypeScript through an external loader, they want a built-in solution.
The real complexity today is in the hoops people have to go through to bypass this limitation that you mentioned here: #63853 (comment)
This PR is small and self-contained in comparison, and it removes that burden.
I also think this opens the door to experimenting in ways that were harder before.

@marco-ippolito marco-ippolito force-pushed the strip-private-node-modules branch from 2cfa6d1 to 76740fc Compare June 12, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. strip-types Issues or PRs related to strip-types support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants