I use vite on react, and when i use yarn to "live server" my project two new files are created, .pnp.loader.mjs and .pnp.cjs. What is the purpose of this files? I never see those files, always use npm or yarn and is the first time that they appear.
Asked
Active
Viewed 2,888 times
7
-
Any update on this one? – abiratsis Jan 08 '23 at 12:54
-
https://yarnpkg.com/features/pnp – Nsevens Jan 30 '23 at 07:58
-
The doc doesn't mention the .pnp.loader.mjs. – Moritz Kampfinger Mar 24 '23 at 10:57
2 Answers
4
The .pnp.cjs
is part of the Yarn Plug'n'Play process, which makes our install and runtime much faster. It makes the node_modules
obsolete.
Yarn also creates an experimental ESM loader which is called .pnp.loader.mjs
.

Jan Willems
- 41
- 4
0
npx create-next-app@latest npx next dev
The issue is from Yarn @Jan Willems says

Yohann Atticot
- 21
- 5
-
-
I use the official documentation and instead to follow the Yarn setup, I’m following the NPM setup – Yohann Atticot Apr 08 '23 at 15:09