preload-webpack-plugin
preload-webpack-plugin copied to clipboard
Add links based on webpackPreload/webpackPrefetch magic comments
As of 4.6.0 webpack will generate links based on webpackPreload/webpackPrefetch magic comments. However where we are attempting to preload/prefetch chunks from an entrypoint loading will not start until the parent as finished (See https://github.com/webpack/webpack/issues/8342#issuecomment-438649676)
It would be great if chunks preloaded from an entrypoint were added as link tags by this plugin. I was thinking of adding an additional includeOption like initialAndChildren.
We would need to use data exposed in stats.entrypoints[].childAssets. The use of the stats api can slow down builds but only calling getStats if the consumer opts in through includeOption: initialAndChildren seems reasonable to me.
Happy to put up a PR if this is acceptable.
Put together a quick PR https://github.com/GoogleChromeLabs/preload-webpack-plugin/pull/109, would be great to get some initial thoughts!