admin管理员组文章数量:1276836
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.
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.
Share Improve this question edited Jul 19, 2023 at 17:41 yivi 47.3k18 gold badges130 silver badges153 bronze badges asked Dec 30, 2022 at 4:12 Esteban SaboEsteban Sabo 2011 gold badge2 silver badges7 bronze badges 3- Any update on this one? – abiratsis Commented Jan 8, 2023 at 12:54
- yarnpkg.com/features/pnp – nsevens Commented Jan 30, 2023 at 7:58
- 1 The doc doesn't mention the .pnp.loader.mjs. – Moritz Kampfinger Commented Mar 24, 2023 at 10:57
3 Answers
Reset to default 13The .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
.
If you do not want the .pnp.cjs
to be created, create a .yarnrc.yml
file in the root directory, add : nodeLinker: node-modules
npx create-next-app@latest
npx next dev
The issue is from Yarn @Jan Willems says
本文标签: javascriptWhy yarn creates a pnploadermjs and pnpcjs filesStack Overflow
版权声明:本文标题:javascript - Why yarn creates a .pnp.loader.mjs and .pnp.cjs files - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738419956a2085802.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论