What is the specific function of optimization.runtimeChunk?

What is the specific purpose of the optimization.runtimeChunk configuration item of

webpack? After reading the document, I still don"t understand

Apr.11,2021

suppose a case where dynamic import is used (using import ()), to dynamically import app.js component.js

  

to optimize persistent caching, runtime refers to the running environment of webpack (module parsing and loading) and module information list, which changes every time a module changes (hash change), so we want to package this part of code separately to match the backend cache strategy. In this way, the cache of the module that contains the information of the module (which is usually included in the last bundle) will not be invalidated because of a change in a module. Optimization.runtimeChunk is to tell webpack whether to package this part separately.

Menu