-
-
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
Set Vite's root cwd() instead of .nuxt
#10981
Comments
Hi @antfu. Apart from vite-plugin-components mentioned in nuxt/framework#239, do you have any other plugin examples? Nuxt DX is via its own ecosystem modules. So naturally, we cannot support some webpack/vite DX plugins without proper nuxt integration. |
I would say most of the vite plugins replying on the
Totally agreed. But I would expect most of vite plugin just works without hacks right? So, if there is no big reason / technical barrier, I would think it's worth to align with the default behaviour of vite. |
It depends. Nuxt features, conventions and integrations like components, pages, and windicss are added as nuxt modules and we don't suggest people adding a vite or webpack plugin directly to the project . But use nuxt modules (~nuxt plugins) that ensures it keeps working with nuxt regardless of chosen bundler :) Shorter: There is no guarantee every webpack/vite plugin works with nuxt out of the box without module integration.
At least currently, there is:
If at some point, we could entirely replace |
It's not really about write outside for buildDir, it's more about path resolving. For example, in {
extract: {
include: ['src/**/*.vue']
}
} the scanning will be resolved incorrectly to (in the
We could use
We are trying to solve this properly without user to explicit configure it for the most of the time, while being safe by default: vitejs/vite#3784 |
As I said, we cannot consider what conventions vite or vite plugins expect (likewise for webpack). Nuxt is only using vite as bundler/transpiler not depending on its plugins for DX. (added dts to #11026). Blocker for changing vite's rootDir, is when we can safely use the full path to entrypoint and sandbox issues are solved (thanks for ref to vitejs/vite#3784)
I see. Still |
Yeah, I could fix the hardcoded path next week. Or if you don't want it, I can also close it and leave to future iterations. |
PR is nice if fixing hardcode / relative resolution between rootDir/buildDir issue :) |
Currently the Vite mode forced the root set to
.nuxt
, while there is a lot of plugins relaying on the vite's root option, this would make them not compatible with nuxt without hacks (or indeed introduces more friction to users). If this is not something we can't overcome, I'd think it's better to keep Vite's root option resolve to current folder.The text was updated successfully, but these errors were encountered: