-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix: warn when publicDir and outDir are nested #13742
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Hi |
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
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.
Is there any case where it's useful to have this?
It could create a difference between dev & preview
If |
My point is that probably this is a misconfiguration of user that don't understand how the public folder works and we should throw instead if there is no good usecase for this. |
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.
I think I'm ok with a warning as a start. I could see some setups wanting the outDir
to be in publicDir
intentionally, and is fine to suppress the warning.
Currently the PR will bail out of copying the publicDir content to outDir, and not only do a warning. Do you think we should only issue the warning? Probably not a bad idea for a patch. Do you have any example of when |
Ah ok I didn't realize we support
In the past when Svelte's main tooling is Rollup, the convention is to build into the public directory, that way you deploy your project through the public directory instead. It's probably rare to have this setup with Vite now but I remember seeing some setups like this before on Discord/Discussions. |
I don't see how copy public inside public dir is a wanted setup. I don't think going for throw now will be an issue, but because I think the this very unlikely given the disk issue with multiple build, it's fine for me now or in Vite 5 |
Ok, let's start emitting the warning so we can start throwing in Vite 5. I did that here: |
Description
There have been a few reports of people having issues debugging after setting an
outDir
andpublicDir
that are nested. I think Vite should disable the public dir feature and warn the user in this case.Example:
See discussion at Discord from @fvsch and a previous issue #3173