Allow override of webpackJsonp behavior
See original GitHub issueFeature request: provide API to hook into webpackJsonp
What is the current behavior?
When using code splitting, Webpack uses webpackJsonp
function to load chunks asynchronously in a browser when a code path that requires that chunk is invoked. On the server Webpack does not do anything for loading async chunks because it doesn’t know what to do.
What is the expected behavior? Provide an API for overriding webpackJsonp behavior so users can hook into it and inject async chunks in HTML that server returns.
If this is a feature request, what is motivation or use case for changing the behavior? Making code splitting with async routes is very hard. Solutions like webpack-flush-chunks seems way too hacky for doing something simple like this.
Question: when targeting node
does web pack do anything different for async chunks?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
You can check https://github.com/lyft/universal-async-component for that
yes, it uses
require
(target node) orfs
+vm
(target async-node) to load chunks.You can override the
__webpack_chunk_load__
function in a bundle to hook into the chunk loading behavior.