Do you want to request a feature or report a bug?
feature
What is the current behavior?
Dynamic imports tagged with /* webpackPrefetch: true */
in the entry chunk are not being prefetched. Per the FAQ, it seems this was intentional; however, I’m not sure why webpack can’t handle this on its own, rather than offloading that to the consumer.
If the current behavior is a bug, please provide the steps to reproduce.
Minimal repo: https://github.com/MLoughry/webpack-7084-repro
Here, the index
dynamically imports a
, which dynamically imports b
. However, the resulting chunkPrefetchMap
is merely:
/******/ var chunkPrefetchMap = {
/******/ "a": [
/******/ "b"
/******/ ]
/******/ }
And nothing is in place to prefetch a
What is the expected behavior?
Dynamic imports tagged with /* webpackPrefetch: true */
in the entry chunk are prefetched
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
webpack@4.6.0
From what I understood, webpack doesn’t prefetch/preload chunks that are direct children of entrypoints. It seems that it assumes that developers are using
html-webpack-plugin
withresource-hints-webpack-plugin
or similar.Anyway, I think it would be useful to have some option to change the behavior to prefetch the direct children as well.