Giter Club home page Giter Club logo

Comments (4)

bendman avatar bendman commented on August 17, 2024

Based on my experience with code splitting for different single page and multi page apps, here's an idea on how it can be structured to be more applicable to a developer looking for info on code splitting (and the different types and reasons).

Note: Is CommonChunkPlugin or the vendor chunk concept something that belongs with code splitting, or is this more specific to the concept of on-demand chunks and require.ensure/System.import?

Potential Outline

  • Reasons for code splitting
    • On-demand routing for Single Page Apps
    • Improved development build times (only building changed chunks)
    • Aggressive cacheability of long-lived/shared code (common/vendor chunk)
  • On-demand chunks
    • specific reasons/benefits (on-demand routing, complex/infrequent logic, authentication security)
    • how to create one
      • note that this happens in the source not in webpack configs
    • examples
      • System.import example
      • require.ensure example
      • any other examples?
      • live examples with available source code?
      • show example network requests to convey the real concept? gif/video?
  • Improving development build times (is this a thing?)
    • some build time results with/without code splitting in dev mode when changing a file
  • Vendor/commons chunking
    • vendor vs commons chunk
      • when to use each / both
    • explicitly including vendor code (vendor chunk)
      • how to know what to include (generated chunk logs)
      • example config and chunk output
    • automatically including common code (commons chunk)
      • example config and chunk output
      • configuration / tuning

from webpack.js.org.

bebraw avatar bebraw commented on August 17, 2024

Great outline and ideas! Thanks.

I can see there are bits like Improving development build times (is this a thing?) that could easily become little articles of their own.

I've been prototyping an enhanced structure that would handle that through a "how to" style miniguide. In that structure this issue would map as "how to split code". Perhaps "how to load code on demand" would be another good split. Doing this would keep the articles short and focused.

Note: Is CommonChunkPlugin or the vendor chunk concept something that belongs with code splitting, or is this more specific to the concept of on-demand chunks and require.ensure/System.import?

It would be good to cover here as it comes up with vendor/commons chunking. That's how I do it in my book.

from webpack.js.org.

pksjce avatar pksjce commented on August 17, 2024

@bendman - How about info on ExtractTextPlugin here? It collects all the css chunks and puts them into a single file right?

from webpack.js.org.

bendman avatar bendman commented on August 17, 2024

@pksjce I feel like that should be linked to from code-splitting, but maybe discussed in detail on its own page or section with plugins. What about briefly discussing it here along the lines of "Code Splitting Non-JS Sources".

from webpack.js.org.

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.