fix(v2): fix babel transpilation include/exclude logic #1868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Previously, there is an edge case bug in which if website path contains
docusaurus
in its name, all the node_modules js file will be transpiled.Example: /mnt/c/Users/endij/Desktop/Linux/test/docusaurus_crash/website/node_modules/@docusaurus/core/node_modules/core-js/modules/_descriptors.js will match the regex
Due to babel smart polyfilling, transpiling files like above that uses commonjs will cause webpack/webpack#4039 (comment)
TypeError: Cannot assign to read only property 'exports' of object '#<Object>'
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
Using regextester. Only docusaurus npm package that are transpiled.
Manually patch new inited site with
docusaurus
on its name