-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-plugin-netlify): add all .js files from webpack.stats.json to _headers #12521
fix(gatsby-plugin-netlify): add all .js files from webpack.stats.json to _headers #12521
Conversation
Looking forward to getting this fix. Thanks @mihaiblaga89 |
Hey @mihaiblaga89! Thanks for your patience with us on this. Here's example
It definitely fixes the problem of grabbing just first chunk. But there is something to potentially adjust:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mihaiblaga89!
Holy buckets, @mihaiblaga89 — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
@pieh Sorry for the late reply, was off the grid for a bit. Thank you too for the filtering, you're right, css is inline. |
… breaks HTTP/2 push) This generates the right markup but the Netlify plugin is still broken (it filters on .js and prevents any other `<link rel="preload">` from making it into `_headers`) See: - gatsbyjs@981bc8c - gatsbyjs#12521 Bogus PR adding files to `_headers` (has the filter on `.js`) - gatsbyjs#9828 gatsby-plugin-netlify v2 excludes some link headers - `from: jc#3330 static-entry.js` search on Discord.
This allows injecting critical style without inlining (antipattern in HTTP/2). ```js // gatsby-browser.js import(/* webpackPreload: true */ `./src/styles/index.sass`) ``` The above generates a `<link as="style" rel="preload" href="/styles.9b011d582aac2f4be01f.css"/>` tag in each page's `<head>`. See: - gatsbyjs@981bc8c - gatsbyjs#12521 Bogus PR adding files to `_headers` (has the filter on `.js`) - gatsbyjs#9828 gatsby-plugin-netlify v2 excludes some link headers - `from: jc#3330 static-entry.js` search on Discord. Caveats: `gatsby-plugin-netlify` doesn't parse `.namedChunkGroups.app.childAssets.preload` in the webpack stats, and simply ignore all assets marked for preloading, so this commit still doesn't enable the expected HTTP/2 behavior on Netlify.
Description
The issue was that only the first file was taken from each key from webpack.stats.json. Modified it to get all of them and render them accordingly.
Related Issues
Fixes to #9828