feat(nuxt): custom history and routes for app/router.options.ts#7129
feat(nuxt): custom history and routes for app/router.options.ts#7129
history and routes for app/router.options.ts#7129Conversation
✅ Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
I like the idea of being able to override history and routes via The factory function for Maybe we can also pass default routes to a factory to allow overriding+modifiying routes from config? (in both regards delaying this PR as well as history for after RC.9 to test better) |
|
Great. Can look into factory routes option as well 👍 Big question in my mind (regardless of the factory function point) is tree-shaking - would be nice to support tree-shaking out auto-generated routes in the event that user fully overrides them, and I'm not sure that rollup will remove them from the build as is. (But then again, nothing stopping user from removing them entirely in the |
|
Agreed that hook is probably best way to override routes. Do you mind adding function support for routes() in order to merge this? |
history and routes for app/router.optionc
history and routes for app/router.optionchistory and routes for app/router.options.ts
history and routes for app/router.options.tshistory and routes for app/router.options.ts
🔗 Linked issue
nuxt/nuxt#14764
❓ Type of change
📚 Description
Alongside first-class 'presets' like nuxt/nuxt#14764 and nuxt/nuxt#13821 which can be configured with a string, it might be useful to allow fully overriding router history + routes for advanced use cases (= escape hatch).
This allows a router options something like this:
Note that this does not replace #6980 as hash history has its own challenges with an SSR framework and needs its own implementation.
📝 Checklist