-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
plug and play support #11823
Comments
@danielroe Can you please share a report of issues we currently have? |
node: v16.11.1 npx nuxi init nuxt3-app
cd nuxt3-app
yarn set version berry
yarn install
yarn build throws the following error: node:internal/modules/cjs/loader:979
throw new ERR_REQUIRE_ESM(filename, true);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/user/Projects/nuxt3-app/.yarn/__virtual__/nuxt3-virtual-e674f51361/0/cache/nuxt3-npm-3.0.0-27235451.ece0e01-3e0c790bfe-b3df0751c7.zip/node_modules/nuxt3/bin/nuxt.mjs not supported.
Instead change the require of /home/user/Projects/nuxt3-app/.yarn/__virtual__/nuxt3-virtual-e674f51361/0/cache/nuxt3-npm-3.0.0-27235451.ece0e01-3e0c790bfe-b3df0751c7.zip/node_modules/nuxt3/bin/nuxt.mjs to a dynamic import() which is available in all CommonJS modules.
at Function.external_module_.Module._load (/home/user/Projects/nuxt3-app/.pnp.cjs:18896:14) {
code: 'ERR_REQUIRE_ESM'
}
|
The officiel Vue repository switched to pnpm (it is the fastest package manager), it would be a shame if nuxt didn't support it vuejs/core#4766 |
@pi0 Off the bat, most of the imports in nitro are failing. Could be more would fail if I could get those to work without using I first brought up the unfortunate dependency on a flat package structure — an undocumented, internal implementation detail — 2 1/2 years ago. At the time you agreed with me, and said it would eventually get fixed. Fast forward to today, and Evan You has just officially switched to using pnpm in the Vue 3 workflow, so I think the time has come to fix this in Nuxt. You guys are really, really smart; there must be a way to write code in such a way that you aren't relying either on implicit dependencies or on the dependency tree being flattened. |
@pi0 Example error message:
|
Dear @aparajita it is not a one-liner fix nor do we have the same level of packaging complexity that vue itself has. We are no longer using implicit internal dependencies in nuxt3 that was an issue in nuxt 2 but the nitro issue is another problem to be fixed. There is a discussion to keep track of https://github.com/nuxt/framework/discussions/939. |
@pi0 Of course I know it isn't a one line fix. But that is my point: wouldn't it be better to be testing with — and preferably using — pnpm all during the development process, so that there is no need to go back and rework things after release? If a package works with pnpm, it will most certainly work with npm/yarn. Can't say for certain about yarn plug and play. |
Of course, it would be the best approach and we are trying to make this happen: nuxt/framework#685. Requirements of yarn pnp and pnpm are almost similar to not depending on |
Since vite and vue-next are using pnpm, wouldn't it seem better to use pnpm for nuxt as well? |
We cannot compare concerns of repo maintenance between nuxt and vue :) Considering we have several components which only one of them is vite, edge channel, unbuild, target tests, etc. Finally, for end-users of nuxt, all three options should be available and somehow automatically tested. What we internally choose to maintain monorepo, is not affecting end-users. |
Just read the blog post about yarn 3. Interesting that they repeatedly say they are trying to catch up to pnpm. 😁 |
Well to be honest besides that currently we use yarn in all of the nuxt repos I have no strong opinions at all about choosing either yarn or pnpm internally. We just currently have so many other issues to address than spending time to switch monorepo from yarn which is already working to pnpm. But we shall focus on generic pnp compatibility allowing users to use choose between either :) BTW while this stat is not fair (since we never recommended pnpm for nuxt users) here is July report of nuxt telemetry: (stats will be open soon!) When we support both yarn and pnpm for nuxt3, we can track to see actually how many users are migrating to pnpm and make decision based on that. |
I am truly amazed at the output of your team. 🙏 |
May I ask if there is already a timeline for this feature? I'm about to start a new project from scratch and would like to use yarn pnp for this and would like to judge if I should wait for a bit or start now without pnp and migrate later to it. So this question is not meant as an annoying "please hurry guys". I do understand that you are working hard on nuxt3! |
pnpm now has support for a flat node_modules without symlinks, that might be of interest. https://github.com/pnpm/pnpm/releases/tag/v6.25.0 |
Today I figured I'd give Nuxt3 a try after using Next.js for a long time. I use pnpm in my projects. Here's what I am seeing:
Thank you for the work being put into this issue. |
Hey I have now read everything 2 times through, but a solution somehow not seen. Node v16.14.0 npx nuxi init test
yarn install
|
@VidarDev For now you will need to set the node modules linker in your nodeLinker: node-modules |
thanks a lot |
We are super close to this! Moving to a new issue #14146 |
@pi0 Is it worth raising an issue for yarn pnp too? |
@zlz9 That is a completely unrelated issue, but has been resolved in nuxt/framework#8299. For now, you can use a higher version of node to work around it. |
…t declared in your dependencies" issue: nuxt/nuxt#11823 (comment)
WIP: nuxt/framework#685
We should allow users to install and use nuxt3 with pnpm and yarn pnp.
Reproduction
pnpm
yarn pnp
The text was updated successfully, but these errors were encountered: