-
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
First incremental build rebuilds all HTML pages #33450
Comments
I've definitely seen the same, feels like it needs a good 2 or 3 builds to "settle" before finally reporting no changes. |
@herecydev thanks for pointing that out! I actually check a different Gatsby project we have and the result is the same: The first incremental build rebuilds all HTML pages, all upcoming incremental builds only rebuild the ones that have changed. The project is our company website, the "bug" is reproducible: https://github.com/satellytes/satellytes.com We just never noticed it there as it only has 37 pages. 1. Build is a full build
After that, the first incremental builds rebuilds all HTML pages
All upcoming incremental builds don't rebuild the HTML files
Our setup here is nearly the same as on the project my initial report is based on, but only with sourcing the file system (and an API request in
|
I did some more research and it turns out: This bug is even within the Gatsby Starter Blog (I didn't test the other starters): https://github.com/gatsbyjs/gatsby-starter-blog I did 3 builds in a row without changing anything. First build
Seconds build
Third build
The example Typescript page shows the build time. This is why every incremental build is rebuilding 1 HTML page, as the build time changes with every incremental build. To check if my assumption is correct, I removed the Typescript file and checked again. Turns out: My assumptions were correct. Also, the second incremental build isn't rebuilding anything! I put the build time query to a different JS file to see if this has an impact on the generated HTML files. The first rebuild built all HTML pages and the seconds one only rebuilt 1 HTML page. The only difference now is that there is no more Typescript file involved. My result for now: Typescript breaks the first incremental build to rebuild all HTML files. |
Ok, it looks like it's not Typescript. I created a small reproduction repo without any dependencies except for Gatsby and React. The issue still appears. I may just have forgotten to delete the Here is the Github Repo: https://github.com/feedm3/gatsby-first-inc-build-bug
I did a full build, copied the public folder to < {"webpackCompilationHash":"2c00ac4d7abf97827f69"}
---
> {"webpackCompilationHash":"4457f437159d17962896"} As expected, running more incremental builds doesn't change the UpdateI removed the static query from a page component. There are now no more Gatsby queries anymore. Still, the problem occurs. Then I removed the one and only import of a styled-components experimentThe first incremental build is working when styles are only used with This is not really a solution, as importing CSS files is essential. But it shows that it's not the styles per se, it's the CSS files. |
Okay, we took a look into this and it seems to be the Interestingly, this only seems to occur when the Disabling cache in
We need to further investigate what it is in the supposed interplay between the cache and the plugin. Thanks for your excellent analysis and helpful reproduction. Cheers! |
Sadly we had to revert this PR and open #34413 as the changes we made introduced breaking changes when using inline loaders, e.g. As the issue could only be fixed by updating the packages I'll not re-open this issue as it can't be fixed until Gatsby 5. I've made |
@LekoArts Did this fix ever make it to Gatsby 5 after all? I believe I'm still seeing the described problem in 5.2 where |
I've also been running into this - the only thing that changes per page is |
@fturmel No, it didn't make the cut for Gatsby 5. For the time we had left just re-applying the first PR would have been a big breaking change and we wanted to make the migration smooth. Maybe the PR can be introduced without a breaking change, but that would need more investigation. |
Hi @LekoArts , did this progress any further on a branch/in a roadmap? Happy to have a look and help out, impacts us quite a lot (and is more acute on larger/higher volume of change sites), just seeing if theres anything half done already etc other than the reverted PR. Thanks! |
@LekoArts any news on this? our build goes from 10m to 2m using cache, but this outdated version of mini-css-extract-plugin sometimes breaks the builds so we have to clean each build |
All I can say after coming here and seeing this is... fuck netlify. |
Preliminary Checks
Description
After running the uncached full build we are doing incremental builds for content updates. This works perfectly except for the very first incremental build. The first incremental build is rebuilding all HTML pages. Here are the logs:
1. The First build is an uncached full build.
25672
page-data.json
files are generated and the same amount of HTML pages.2. The first incremental build rebuilds all HTML pages, although it detects the changes correctly and also only updates the necessary
page-data.json
filessuccess run page queries - 1.528s - 32/32 20.94/s success write out requires - 0.244s success Building production JavaScript and CSS bundles - 3.630s success Caching JavaScript and CSS webpack compilation - 0.024s success Rewriting compilation hashes - 0.003s success Writing page-data.json files to public directory - 0.226s - 32/32 141.57/s success Building HTML renderer - 10.719s success Caching HTML renderer compilation - 2.281s success Building static HTML for pages - 756.263s - 25672/25672 33.95/s
32
page-data.json
files are correctly updated, but all 25673 HTML files are rebuilt. This is unnecessary as there wasn't any content update to that many files.3. All upcoming builds work without any issues and are very fast
success run page queries - 1.893s - 32/32 16.91/s success write out requires - 0.383s success Building production JavaScript and CSS bundles - 4.657s success Caching JavaScript and CSS webpack compilation - 0.012s success Writing page-data.json files to public directory - 0.246s - 32/32 130.31/s success Building HTML renderer - 11.956s success Caching HTML renderer compilation - 0.622s success Building static HTML for pages - 0.829s - 1/1 1.21/s
32
page-data.json
files and 1 HTML page is correctly updated. All further incremental builds also work perfectly.Current situation
I don't understand what has an impact on the decision if an HTML file gets rebuild or not, besides the content. I would be super happy if there are some ideas about where the problem could be. Building HTML files within our project take a long time and we want to cut it as much as possible.
Reproduction Link
Steps to Reproduce
Unfortunately, I cannot reproduce this issue on a different repository as our setup uses a custom sourcing plugin we build with the fantastic gatsby-graphql-toolkit.
What we do within is plugin is:
We also modify the webpack config a little bit:
Additional libraries we use:
styled-components
andtypescript
.The problem occurs on the latest Gatsby 3 (3.14.1) and Gatsby 4 Version.
Expected Result
All incremental builds only update and rebuild the necessary HTML pages.
Actual Result
The first incremental build rebuilds all HTML pages, all upcoming incremental builds only rebuild the changed HTML pages.
Environment
Config Flags
The text was updated successfully, but these errors were encountered: