Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for stats.entrypoints[].childAssets #934

Closed
jantimon opened this issue Apr 26, 2018 · 10 comments
Closed

Add support for stats.entrypoints[].childAssets #934

jantimon opened this issue Apr 26, 2018 · 10 comments
Labels

Comments

@jantimon
Copy link
Owner

jantimon commented Apr 26, 2018

Webpack 4.6 allows to prefetch/preload dependencies using dynamic imports:

https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c

The webpack core api allows to consume those information also for html generation.
So we could turn the following data into <link /> tags:

console.log(stats.entrypoints[].childAssets);

{ 
 main: 
 { 
   assets: ["a.js", "a.css"], 
   childAssets: { 
     preload: [ assets: ["b.js", "b.css"] }, 
     prefetch: { assets: ["c.js", "c.css"] 
    } 
 } 
}

--->

head
  link(rel=preload, href=a.js, as=script)
  link(rel=preload, href=a.css, as=stylesheet)
  link(rel=preload, href=b.js, as=script)
  link(rel=preload, href=b.css, as=stylesheet)
  link(rel=prefetch, href=c.js, as=script)
  link(rel=prefetch, href=c.css, as=stylesheet)
  ...
  link(rel=stylesheet, href=a.css)
body
  ...
  script(src=a.js)

@mastilver do you think we should add this to the html-webpack-plugin itself or rather as a plugin?

@loveky
Copy link

loveky commented Jul 31, 2018

hi guys, any update on this feature?

@loveky
Copy link

loveky commented Jul 31, 2018

will look into this to see if I can make a PR

@jantimon
Copy link
Owner Author

@loveky cool 👍
right now I am refactoring a lot for #953 so it will take some time till I can work on this topic

@stale
Copy link

stale bot commented Jan 27, 2019

This issue had no activity for at least half a year. It's subject to automatic issue closing if there is no activity in the next 15 days.

@stale stale bot added the wontfix label Jan 27, 2019
@stale stale bot closed this as completed Feb 11, 2019
@glen-84
Copy link

glen-84 commented Feb 16, 2019

@jantimon Should this be re-opened?

@jantimon
Copy link
Owner Author

jantimon commented Feb 16, 2019

I believe this feature would aid many however the information can only be retrieved using a very slow api.

So it would slow down the compilation for all users. If we can find a perfomant way to access this information I would be more than happy to integrate it

@glen-84
Copy link

glen-84 commented Feb 17, 2019

Is there a webpack issue tracking this performance problem?

@jantimon
Copy link
Owner Author

The webpack core team even provided a new api to get access to the entry point assets so we could speed up the build

@raRaRa
Copy link

raRaRa commented Mar 7, 2019

Hi, any update on this? AFAIK, create-react-app are waiting for this fix in order to add support for webpackPrefetch and webpackPreload.

facebook/create-react-app#3319

@jantimon
Copy link
Owner Author

As said before this needs support from the webpack api to provide those data in a performant way.

I am not aware if there is already a issue for that on their issue tracker.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants