-
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
Infinite loop with graphqlTypegen and tailwindcss #35775
Comments
Hi! This issue is happening due to a misconfiguration of Tailwind CSS on your end. They have this documentation section: https://tailwindcss.com/docs/content-configuration#styles-rebuild-in-an-infinite-loop Exactly that is happening with your Once you don't watch the generated file anymore it doesn't rebuild. So https://www.gatsbyjs.com/docs/how-to/styling/tailwind-css/#4-configuring-your-content-path should get a paragraph saying that when GraphQL Typegen is used the generated file should be ignored. |
That's what I thought. The problem is a lot of projects have quite a few subdirectories below src and a few utility files under src. That's why I tend to use the wildcard option. I did try to ignore the gatsby-types.d.ts file but that didn't seem to fix anything. The only way I could work around it was to output the gatsby-types.d.ts to a different directory and then update tsconfig.json. |
According to glob tester website this should work: content: ["./src/**/!(*.d).{ts,tsx}"], But it doesn't, in my testing. So for this you should open a bug report with Tailwind CSS. |
I've raised an issue on Tailwind CSS. Is it possible to provide a configuration option for the |
For that you'll want to open a feature request here: https://github.com/gatsbyjs/gatsby/discussions/categories/ideas-feature-requests |
Done at #35779 Thanks |
Another question on this - is there a reason why this file is re-created each time? Surely it should only be created if something has changed. |
Just had a response back from tailwind on the issue I raised.
So it looks like they don't have a solution to this that fits nicely. I suspect this issue will become more apparent once more people start using the graphql typegen functionality. My workaround where I modify ts-codegen.js in the node_modules folder to change the name of the output file is working well on a couple of my projects for local testing, but will prevent me from migrating more projects to use the typegen functionality. |
I can't promise a timeline for when options for The action item for this issue here will be updating our documentation to mention that you should update your |
Same issue here. Unfortunately |
If anyone has a similar issue, I've created a temporary plugin It is pretty much a copy of the built in version, but allows you to pass an option in to configure the output file. You can see how I use it in the example https://github.com/nrandell/gatsby-tailwind-loop/blob/23f2a711929556822c1599e419940a4173970c4d/gatsby-config.ts#L35 You need to make sure that your tsconfig.json references gatsby-*.ts as in https://github.com/nrandell/gatsby-tailwind-loop/blob/23f2a711929556822c1599e419940a4173970c4d/tsconfig.json#L104 and it will work. I'm going to start using it in some of our projects so I may make some changes, but in my small tests it's working so far. |
Even |
Please report that to Tailwind, it's nothing we can do about :) |
This is the solution for my case
|
The problem is that the gatsby-types.d.ts file is generated in the src directory. If there was an option to generate it somewhere else, the infinite loop would not happen. Generating a file in the same directory as source files is a bad idea anyway. |
it's not work, It seems that you can only wait for the configuration to specify the .d.ts output |
The alternative is to use the gatsby-plugin-typegen plugin instead: // See https://www.gatsbyjs.com/plugins/gatsby-plugin-typegen/
{
resolve: `gatsby-plugin-typegen`,
options: {
outputPath: `typegen/gatsby-types.d.ts`,
emitSchema: {
'typegen/gatsby-introspection.json': true,
'typegen/gatsby-schema.graphql': true,
},
emitPluginDocument: {
'typegen/gatsby-plugin-documents.graphql': true,
},
},
}, I don't know if it does the same thing but at least you can should where everything goes. |
This error originated with
Commenting this out fixed the infinite looping for me. |
Setting the source filesystem retrieval scope does work,Thanks for the ideas |
Something was playing up with the ** wildcard used in the changed string. See gatsbyjs/gatsby#35775 and https://www.gatsbyjs.com/docs/how-to/styling/tailwind-css/
Preliminary Checks
Description
If you have a project with tailwindcss and graphqlTypegen the build triggers an infinite loop due to the gatsby-types.d.ts changing.
Reproduction Link
https://github.com/nrandell/gatsby-tailwind-loop
Steps to Reproduce
yarn install
yarn develop --verbose
Expected Result
A single pass at building
...
Actual Result
It continues a number of times - some projects are infinite!
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: