-
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
gatsby-plugin-netlify v2 excludes some link headers #9828
Comments
Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open! |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
I'm having the same issue. In my page html I have this:
In
|
I think this should be reopened. The critical CSS in my HTML: <link as="style" rel="preload" href="/styles.9b011d582aac2f4be01f.css"/> …also doesn't make it into |
… 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.
does anyone have a guide on how to do the following: https://www.gatsbyjs.org/docs/caching/ ? |
Description
Since migrating to Gatsby V2 - it appears that fewer JS files are eligible to be be considered for preloading when generating the
_headers
file.Steps to reproduce
Add gatsby-plugin-netlify to gatsby-config, no options are necessary.
Build project and view
public/_headers
Compare results of
/
with the headers inpublic/index.html
In Gatsby V1 - more JS bundles matched - so fewer v2 JS files are being http2/pushed
Expected result
A higher number of JS bundles should match the Link Header filter.
Actual result
Typically only two javascript files are linked. In Gatsby V2 - I would also suggest that /static/*.json files should also be eligible (
<link rel="preload" href="/static/d/688/path---index-6a9-DFSIFoYuSMh60BvyPO97Ulcr4c.json" as="fetch"/>
)example:
Environment
The text was updated successfully, but these errors were encountered: