Thursday 29 December 2022

Webpack code splitting - Automatically load all chunks by requesting a single chunk?

I'm using Webpack 4.x and have the following in my config:

splitChunks: {
    chunks: 'all',
},
runtimeChunk: true

This results in three chunks in my project:

  • app.prod.js
  • 1.app.prod.js
  • 2.app.prod.js

I'd like to load all three scripts using just one initial request. The reason for this is that I'd like to use the "preload" feature in Electron for security reasons, which accepts a single script.

Is there a way to have the initial app.prod.js require/import the additional chunks automatically?



from Webpack code splitting - Automatically load all chunks by requesting a single chunk?

No comments:

Post a Comment