feat(dev-server): Add .md/.mdx to defaultOptions.exclude #322
+6
−0
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.
Summary
.md/.mdxfiles from dev-server request handling so they pass through ViteMotivation
Using
@mdx-js/rollupwith@hono/vite-dev-servercauses.mdxfiles to be intercepted by the dev server and treated as HTTP routes (e.g.No route matches URL "/app/routes/privacy.mdx").This happens because the default exclude list does not include Markdown/MDX files.
Adding
.mdx?avoids the interception and lets Vite handle transforms as intended.Current Workaround
Users must override the entire exclude list to add MDX support (for a React Router v7 app):
This is error-prone because:
??, not a spread/concat).Alternatively, we could add a safe way to extend the default excludes, but that would be a lot more work. Supporting
.md/.mdxcovers a large share of common use cases.