docs: clarify type stripping behavior in node_modules#379
docs: clarify type stripping behavior in node_modules#379Mohitlikestocode wants to merge 4 commits intonodejs:mainfrom
Conversation
There was a problem hiding this comment.
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_STRIPPINGerror - Clarified this restriction was introduced after
--experimental-strip-typeswas 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>
|
@marco-ippolito |
|
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
This sentence is weird, makes it seem like when user as a loader Amaro always tried to handle files inside node_modules.
|
@Mohitlikestocode can you please apply the review comments, I'd like to merge this PR |
|
Thanks for the review!! @marco-ippolito Could you take another look? Really sorry for replying late, had my semester exams going on. |
Co-authored-by: Marco Ippolito <marcoippolito54@gmail.com>
Summary
This PR updates the README to clarify the current behavior of type stripping under
node_moduleswhen Amaro is used as a loader.Recent Node.js versions block type stripping for files inside
node_modules, which causes Node.js to throwERR_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-typeswas 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
README.md--experimental-strip-typeswas unflaggedReferences
nodejs/node@53b1050Checklist