Comments (4)
I see the problem but you haven't mentioned what it is that you're trying to achieve. Are you simply trying to add a new route? Or are you trying to add a new chunked route?
from pwa.
Thanks lakshya u looked into it. What i want to achieve is that suppose i am on pageA from which when i navigate i go to pageB then as soon as i navigate pageB bundle is downloaded, now from pageB i navigate to pageC so now pageC bundle is downloaded. There is no problem with this approach as in the route we can lazy import these bundles as per the route. What i want is PageA bundle contains PageB and PageC bundles also so that when i navigate from PageA to PageB then i already have PageB bundle. So bro let me know what i am doing wrong with mine webpack configuration.
from pwa.
The recommended approach to do this is to to wait for the LandingPage(PageA) route to render and then explicitly lazy import all the other routes FindPage and SearchPage(PageB and PageC) in the second .then
of the LandingPage. For example:
<IndexRoute
name="landing"
getComponent={(_, cb) => {
Promise.all([
import('./views/LandingPage/LandingPage' /* webpackChunkName: 'landing' */),
importCss('landing'),
]).then(([module]) => cb(null, module.default)).then(() => {
import('./views/FindPage/FindPage' /* webpackChunkName: 'find' */);
importCss('find');
import('./views/CitiesPage/CitiesPage' /* webpackChunkName: 'cities' */);
importCss('cities');
});
}}
/>
<Route
name="find"
path="/find/"
getComponent={(_, cb) => {
Promise.all([
import('./views/FindPage/FindPage' /* webpackChunkName: 'find' */),
importCss('find'),
]).then(([module]) => cb(null, module.default));
}}
/>
<Route
name="cities"
path="/cities/"
getComponent={(_, cb) => {
Promise.all([
import('./views/CitiesPage/CitiesPage' /* webpackChunkName: 'cities' */),
importCss('cities'),
]).then(([module]) => cb(null, module.default));
}}
/>
Advantage of this approach compared to bundling the 3 routes together is that you still keep separate chunks which means your time to first interactivity is still low. And, the other routes are lazy loaded on DOMContentLoaded so you're not competing for bandwidth with other critical resources.
from pwa.
Thanks bro...
from pwa.
Related Issues (9)
- The syntax of the command is incorrect. HOT 2
- how is the Server worker working on http request, Can you please elaborate HOT 4
- Is it does server side rendering ?
- R Router 4 HOT 4
- Question: Does it work offline or the support is there? HOT 1
- Double import of `babel-polyfill`? HOT 1
- Server-side rendering and async routing
- npm install fails on Windows 10 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pwa.