Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Chrome Warning message regarding not using preloaded chunks #8
Just trying out this plugin for two chunks generated by webpack code splitting, everything seems to working fine but in console I am getting these warnings.
Now the error makes sense, but it could take the user a few seconds to navigate to the route which requires these chunks. Is there anyway to stop this error message ?
I.e I preload these code-splitting chunks as follows
but they are not loaded on "home" route, only when the user navigates to i.e. "favourites"
Edit : I guess I should be using prefetch
Thanks for asking a good question. Unused preloads in Chrome will trigger a console warning ~3 seconds after onload. This happens when the resource isn't being consumed (e.g you're not trying to use a script you've preloaded) in a timely manner.
If the resource is needed for the current navigation & will be used, go for preload. If the resource is needed beyond that (and you're not using in the current nav), I'd go for prefetch.
Thanks for replying, I was just going to try and close this before I saw your reply, as I felt stupid after reading more about the difference between prefetch and preload.
My first impression was preload was the cool new thing in town to replace prefetch. But I guess there is still a need for both.
Thanks for the answer.