Skip to content

webpackPrefetch not prefetching dynamic imports from entry chunk #7084

@MLoughry

Description

@MLoughry

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions