fix!: only serve dev static assets from publish dir as fallback #508
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #436
Problem
When using
@netlify/vite-plugin,vite dev(or e.g.astro dev) was incorrectly serving files from the Netlify publish dir (e.g.dist/) instead of the source directory during vite dev.This causes various problems, the most basic of which is that if you've ever previously run
vite build(or e.g. `astro build) your dev server scans the production build output dir and serves assets from it. This is confusing and incorrect.Solution
I can't think of any reason to ever augment the directories explicitly passed to
@netlify/dev's options with a default directory. In every known use case (@netlify/vite-plugin,@netlify/nuxt...), we pass the known, exhaustive set of directories that should be used to serve static assets in dev, so we should respect these as is.It seems reasonable to use some sensible defaults here when not provided (for hypothetical future or direct use cases).
This PR makes this change.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.