Giter VIP home page Giter VIP logo

Comments (6)

yyx990803 avatar yyx990803 commented on May 19, 2024

This is expected - only CSS in the initial entry chunk is extracted. Any async-loaded chunks CSS is dynamically inserted. This is actually recommended because you don't want to load all the CSS in your async chunks on initial load.

See http://webpack.github.io/docs/stylesheets.html#separate-css-bundle

from webpack.

DarKDinDoN avatar DarKDinDoN commented on May 19, 2024

Consider the same example as vuejs/vue-loader#139 with vue-router and lazy-load to switch between ComponentA and ComponentB.

Each component has its own chunk (0.js = ComponentA & 1.js = ComponentB) and each chunk contains the same CSS.

Each chunk has its own piece of css, but each chunk is bigger. It would be best if the CSS was extracted in a file that is required along with the chunk. This way, if the CSS is already in cache, the new chunk use it.

from webpack.

yyx990803 avatar yyx990803 commented on May 19, 2024

You can do that if you want to, just remove the vue-style-loader argument on these lines: https://github.com/vuejs-templates/webpack/blob/master/template/build/webpack.prod.conf.js#L27-L30

from webpack.

DarKDinDoN avatar DarKDinDoN commented on May 19, 2024

Still the same with vue-loader-style removed.

Each chunk contains the required CSS. Even if the CSS code is exactly the same.

from webpack.

yyx990803 avatar yyx990803 commented on May 19, 2024

Oh I guess I misunderstood your last comment. See this section: http://webpack.github.io/docs/stylesheets.html#styles-in-commons-chunk

from webpack.

DarKDinDoN avatar DarKDinDoN commented on May 19, 2024

👍 thank you sir !

from webpack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.