Skip to content

Webpack hot reloading loop with Gatsby + Tailwind v4 (after migration) #17610

Closed
@jasonohdz1501

Description

@jasonohdz1501

What version of Tailwind CSS are you using?

Tailwind 4.1.3

What build tool (or framework if it abstracts the build tool) are you using?

"gatsby": "^5.14.1", "gatsby-plugin-postcss": "^6.13.1"

What version of Node.js are you using?

v20.13.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Describe your issue

After upgrading to Tailwind v4, I've found issues when running gatsby develop, cause seems that the new configuration of Tailwind is crashing with the way Webpack and Gatsby watch the css changes through postcss. My guessing is that since Gatsby is using 'gatsby-plugin-postcss', seems that now the separate postcss package for tailwind is crashing the hot reload and it's causing an infinite loop, by console it's throwing this:

[HMR] css reload http://localhost:8000/commons.css
client.js:247 [HMR] bundle 'develop' rebuilt in 226ms
client.js:238 [HMR] bundle rebuilding
client.js:247 [HMR] bundle 'develop' rebuilt in 229ms
client.js:238 [HMR] bundle rebuilding
client.js:247 [HMR] bundle 'develop' rebuilt in 232ms
client.js:238 [HMR] bundle rebuilding
client.js:247 [HMR] bundle 'develop' rebuilt in 245ms
client.js:238 [HMR] bundle rebuilding
process-update.js:123 [HMR] Updated modules:
process-update.js:125 [HMR]  - ./.cache/blank.css
process-update.js:125 [HMR]  - ./src/styles/globals.css

So, I've tried several things such as: included importing the tailwind.config.js per as docs, keep the @tailwind base; @tailwind components; @tailwind utilities;, among others

Before, to try implement a different way of using tailwind, which will be stay apart of webpack-postcss, instead going down through a separate build process using tailwindcss/cli and include that extra step in the build pipeline. I'd like to validate with you if there's some solution that I'm not seeing, thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions