Node.js adds --experimental-strip-private-modules flag
Node.js introduced the CLI flag --experimental-strip-private-modules, which limits type stripping to packages marked private: true in package.json. The change protects public packages from losing typings and closes a loophole where private packages were hidden in nested node_modules.
- The flag enables selective type stripping only for packages with private: true
- Public packages no longer lose their type information during builds
- Logic in package_json_reader.js and node_modules.cc detects nested private packages
- New tests added in test/es-module/test-typescript.mjs
Read next
Software