Dynamic import() with webpackPrefetch cause duplicate request

Bug report

What is the current behavior?

When I click the button to lazy-load a module which was already been prefetched (I can see it in the network tab), another network request for the same module is done.

If the current behavior is a bug, please provide the steps to reproduce.

Minimal repository: test-webpack-dynamic-import-prefetch

What is the expected behavior?

If the button is clicked that lazy-module should be called from the browser’s cache without additional network request.

Other relevant information:

webpack version: 4.18
Node.js version: 8.11
Operating System: Windows 10
Additional tools: Chrome 69

Author: Fantashit

1 thought on “Dynamic import() with webpackPrefetch cause duplicate request

  1. When I click the button to lazy-load a module which was already been prefetched (I can see it in the network tab), another network request for the same module is done.

    That’s correct, but the second request should be fulfilled from (disk) cache. (Make sure to not “disable cache” in devtools)

Comments are closed.