Check this thread for a good solution to many woes around this. We also had inflated bundle sizes and broken tree shaking unknowingly. Changing to build-time generation (with HMR still) fixed it all.
@jfairley I've excluded the ignored files/directories from Vite's glob pattern and that did that trick to exclude the ignored routes from the production build bundle. It's now released at v1.19.3!
Describe the Bug
Files within
src/pages
not matching the "routes" or "modals" globs are included in the resulting bundle (/dist
).Generouted Version
@generouted/react-router 1.16.0
Your Example Website or App or Reproduction
I couldn't get generouted working in stackblitz.
Steps to Reproduce the Bug or Issue
src/pages/_i-am-ignored.tsx
would dosrc/pages/*.stories.ts
)dist
to find that the contents of your ignored file made their way into the output.@generouted/react-router/lazy
, since it creates separate files.Note: The ignored file is correctly excluded from the route tree, yet it is bundled into dist.
Expected Behavior
Ignored files do not end up in
dist
.Screenshots or Videos
No response
Platform
Additional context
No response