You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SFC custom block and JSX/TSX YAML format comments are not perfect method to custom route data, especially when I want to use imported data in route data:
If I add too much support to this is kind of thing which is framework specific, will cause this plugin to become hard to maintain.
I personal will recommend using some existing solution like Remix to resolve that kind of requirement.
@hannoeru I don't think it is framework specific. Actually, merging custom data from page file with generated route from plugin in virtual module is feasible methods, which is what I do currently.
I used import.meta.glob to achieve it, just like:
// as a part of virtual moduleconstcustoms=import.meta.glob(['~/pages/**/*.tsx','!~/pages/**/components/*'],{import: 'route',eager: true},);
of course, it will throw error when the page file don't export named route data, so we can add export route = {} to solve it on transform hook.
Description
SFC custom block and JSX/TSX YAML format comments are not perfect method to custom route data, especially when I want to use imported data in route data:
Suggested solution
custom route data in runtime code is maybe better method, it has natural framework-independence advantage, and support type check:
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: