Skip to content

Lazy loading chunks downloaded before route visiting #1153

Closed
@noscript

Description

@noscript

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions