Skip to content

Lazy loading chunks downloaded before route visiting #1153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
noscript opened this issue Apr 19, 2018 · 2 comments
Closed

Lazy loading chunks downloaded before route visiting #1153

noscript opened this issue Apr 19, 2018 · 2 comments

Comments

@noscript
Copy link

noscript commented Apr 19, 2018

Version

3.0.0-beta.6

Reproduction link

https://github.com/noscript/vue-cli-lazy-load

Steps to reproduce

Change About to an async component in router.js:

-import About from "./views/About.vue";
+const About = () => import("./views/About.vue");

Serve the app and open in browser. Check Networks tab in Chrome devtools, chunk 0.js is downloaded with prefetch. Visit About view, 0.js is downloaded normally.

What is expected?

Chunk is downloaded only when visiting the route, according to https://router.vuejs.org/en/advanced/lazy-loading.html

What is actually happening?

Chunks from all async components are downloaded at once.


This is a regression from vue-cli 2.9.3. Although the chunks are defined with prefetch, they are actually downloaded anyway (on the background, idle time etc).

@emanuelmutschlechner
Copy link

Can confirm.

Tested it with 3 separate chunked About.vue pages and added a large image to index.html.

<head>
    <link rel="prefetch" as="image" href="image.png">
</head>

Results in Chrome:
ac
Results in Firefox:
af

Seems like Firefox starts downloading prefetch elements when document is ready, but Chrome not. I used network throttling for more accurate timeline

@LinusBorg
Copy link
Member

This is a regression from vue-cli 2.9.3.

Well, Vue 3 is a new major version - breaking changes are kind of what major versions are for.

Closing as duplicate of #979

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants