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
In a big application, views should be split up into separate JS bundles so that the main bundle doesn't keep growing as more views are added.
Describe the solution you'd like
Add a lazy: boolean field to ViewConfig. The default value is false for a view mapped to / or /login and true for all other views. (Yes, this is yet another property where the default is true but that's fine-ish since lazy is much more descriptive than any other name that I've considered).
For a view that is lazy (either explicitly configured or based on the default), we generate file-routes.ts to do const ViewName = lazy(() => import("../views/view-name.js")) instead of the current import * as ViewName from "../views/view-name.js".
Describe alternatives you've considered
We might also want to make it possible to group multiple related views into a single import instead of creating a separate import for each view. We can add that later by changing the type of lazy to boolean | string and changing the logic for generating file-routes.ts so that all views using the same lazy string value are imported from the same URL (by generating a separate helper file that imports and re-exports all desired views).
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe your motivation
In a big application, views should be split up into separate JS bundles so that the main bundle doesn't keep growing as more views are added.
Describe the solution you'd like
Add a
lazy: boolean
field toViewConfig
. The default value isfalse
for a view mapped to/
or/login
andtrue
for all other views. (Yes, this is yet another property where the default istrue
but that's fine-ish sincelazy
is much more descriptive than any other name that I've considered).For a view that is lazy (either explicitly configured or based on the default), we generate
file-routes.ts
to doconst ViewName = lazy(() => import("../views/view-name.js"))
instead of the currentimport * as ViewName from "../views/view-name.js"
.Describe alternatives you've considered
We might also want to make it possible to group multiple related views into a single import instead of creating a separate import for each view. We can add that later by changing the type of
lazy
toboolean | string
and changing the logic for generatingfile-routes.ts
so that all views using the samelazy
string value are imported from the same URL (by generating a separate helper file that imports and re-exports all desired views).Additional context
No response
The text was updated successfully, but these errors were encountered: