Promise and lazy routes...
See original GitHub issueAmazing router! Congratulations!
Looking at yrv
router (a good router!) we can see two ways of importing routes:
<Router>
<Route exact path="/promise" component={import('path/to/other-component.svelte')}/>
<Route exact path="/lazy" component={() => import('path/to/another-component.svelte')}/>
</Router>
The promise way I think is amazing because I can have a lot of routes and maybe I just need to load immediately just the one I need and after that in background start downloading others.
Can we do the same with tinro
?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Promise and lazy routes... · Issue #104 · ItalyPaleAle/svelte ...
Not bad but I think svelte-spa-router needs something internal, three-shackable, both promising and lazying , with pending prop (or something else to indicate...
Read more >Uncaught (in promise): Error: Cannot match any routes. URL ...
I am trying to lazy load the orders module which has two components orders and test. The orders route is working fine but...
Read more >Lazy Loading Routes | Vue Router
Lazy Loading Routes # ... When building apps with a bundler, the JavaScript bundle can become quite large, and thus affect the page...
Read more >How To Use Lazy Loading Routes in Angular | DigitalOcean
In this article, you will use lazy loading routes in an Angular ... The dynamic import is promise-based and gives you access to...
Read more >Lazy Loading Routes using an Observable with the Angular ...
The snippet above uses the loadChildren property in the Route object to lazy load the route using a Promise. This API is defined...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks =) I’ll look for a way of minimal implementation of this. Module size is priority.
Little change in
Lazyloader.svelte
: Replace{#await cmp()}
by{#await cmp.then ? cmp : cmp()}
and you will be able to use either import or functions ascmp
property.Just load imports in variables in root file if you want to do preloading. Then use this variables for
cmp
property. Or just use<Lazylaoder cmp={import('./Something.svelte')}/>
and components will be downloaded when current component will be mounted.