-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Update Configuration.md for added special notes on usage scenarios for pnpm. #13115
Conversation
Added special notes on usage scenarios for pnpm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -1651,6 +1651,20 @@ Example: | |||
} | |||
``` | |||
|
|||
:::tip | |||
|
|||
If you use pnpm and need to convert some packages under `node_modules`, you need to note that the packages in this folder (eg `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (eg ` node_modules/.pnpm/package-a@x.x.x/node_modules/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use pnpm and need to convert some packages under `node_modules`, you need to note that the packages in this folder (eg `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (eg ` node_modules/.pnpm/package-a@x.x.x/node_modules/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: | |
If you use `pnpm` and need to convert some packages under `node_modules`, you need to note that the packages in this folder (e.g. `node_modules/package-a/`) have been symlinked to the path under `.pnpm` (e.g. `node_modules/.pnpm/package-a@x.x.x/node_modules/pakcage-a/`), so using `<rootdir>/node_modules/(?!(package-a|package-b)/)` directly will not be recognized, while is to use: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Added special notes on usage scenarios for pnpm.
Summary
see #12984.
I use Jest to test a tool library packaged with Rollup, which uses the two ES Module packages
lodash-es
anddayjs/esm
, since my Node.js does not support direct execution of ES Module (I There is no corresponding configuration), so I need to do conversion, and I checked the documentation, installedbabel-jest
and configuredbabel.config.js
andjest.config.js
:It works fine.
When I replaced yarn with pnpm and executed Jest for unit testing, an error occurred. Then I spent a lot of time investigating, and finally I found this Issue, which matched my scenario. I made a slight modification according to the comments below. :
It passed.
As more and more people use pnpm, I'm sure that many people will encounter this problem in the future, and an update to the documentation here is necessary to prevent more people like me from spending as much time on this problem.
So I updated the documentation.
Test plan
First, it worked on my device.
But this seems to be difficult to test. In order to design test cases, we need to use pnpm as the package manager, and construct an actual
node_modules
directory structure, and then set the corresponding structure oftransformIgnorePatterns
injest.config.js
, and then check if the package has been converted by babel.I think this seems unnecessary, so I didn't do the corresponding processing.