Skip to content

docs: clarify type stripping behavior in node_modules#379

Open
Mohitlikestocode wants to merge 4 commits intonodejs:mainfrom
Mohitlikestocode:main
Open

docs: clarify type stripping behavior in node_modules#379
Mohitlikestocode wants to merge 4 commits intonodejs:mainfrom
Mohitlikestocode:main

Conversation

@Mohitlikestocode
Copy link

@Mohitlikestocode Mohitlikestocode commented Feb 5, 2026

Summary

This PR updates the README to clarify the current behavior of type stripping under node_modules when Amaro is used as a loader.

Recent Node.js versions block type stripping for files inside node_modules, which causes Node.js to throw ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING. This restriction is enforced by Node.js itself.


Motivation

The README currently implies that type stripping in dependencies works when using Amaro as a loader.
However, after --experimental-strip-types was unflagged, Node.js disallows this behavior and throws an error instead.

This change aligns the documentation with current Node.js behavior and avoids confusion for users.


Changes

  • Update the “Type stripping in dependencies” section in README.md
  • Clarify that:
    • The limitation is enforced by Node.js
    • The behavior changed after --experimental-strip-types was unflagged
    • This is not an Amaro bug

References


Checklist

  • Documentation-only change
  • No code changes
  • Tests not required

Copilot AI review requested due to automatic review settings February 5, 2026 11:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the README to clarify that type stripping for files under node_modules is blocked by recent Node.js versions, addressing confusion in the documentation that previously suggested this feature worked when using Amaro as a loader.

Changes:

  • Updated the "Type stripping in dependencies" section to reflect current Node.js behavior
  • Added explanation that Node.js throws ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING error
  • Clarified this restriction was introduced after --experimental-strip-types was unflagged

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Mohitlikestocode
Copy link
Author

@marco-ippolito
Hey Marco, I've sent a PR to solve the docs issue about the type of strippng behaviour in node_modules.
I'd like to know whether this pr can be merged, thanks!

@marco-ippolito
Copy link
Member

Ill take a look thanks

README.md Outdated
When used as a loader, Amaro attempts to handle TypeScript files inside folders under a `node_modules` path.
However, recent Node.js versions disallow type stripping for files under `node_modules` and throw
`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`. This behavior is enforced by Node.js and changed after
`--experimental-strip-types` was unflagged. As a result, type stripping in dependencies does not work on
Copy link
Member

Choose a reason for hiding this comment

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

I dont think its necessary in the documentation to explain why this feature stopped working

README.md Outdated
#### Type stripping in dependencies

Contrary to the Node.js [TypeScript support](https://nodejs.org/docs/latest/api/typescript.html#type-stripping-in-dependencies), when used as a loader, Amaro handles TypeScript files inside folders under a `node_modules` path.
When used as a loader, Amaro attempts to handle TypeScript files inside folders under a `node_modules` path.
Copy link
Member

Choose a reason for hiding this comment

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

This sentence is weird, makes it seem like when user as a loader Amaro always tried to handle files inside node_modules.

@marco-ippolito
Copy link
Member

@Mohitlikestocode can you please apply the review comments, I'd like to merge this PR

@Mohitlikestocode
Copy link
Author

Thanks for the review!! @marco-ippolito
I’ve updated the README to remove the “why it stopped working” explanation and adjusted the wording so it doesn’t imply Amaro always handles files under node_modules.

Could you take another look? Really sorry for replying late, had my semester exams going on.
Please let me know if there is anything else you'd suggest me to do!

Co-authored-by: Marco Ippolito <marcoippolito54@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stripping on node_modules doesn't work when used as loader

2 participants