When we use lazy-loading for downloading specific web modules, eg:
import('./polyfills').then(render);
Will the browser cache these dynamically loaded files and does webpack use the cached version on subsequent requests?
With bundle splitting I know the browser will cache the loaded files; I assume this should be the same for code splitting, but I'm not sure.
Cache-Control
response header specifies if and for how long a resource can be cached. Your server is responsible for setting it.
When webpack-generated code encounters a dynamic import, it fetches and then executes it. Whatever is exposed by the module is then available as long as the page isn't closed/reloaded and when the same import is encountered again those in-memory bindings are used (the module isn't refetched or executed again).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.