Infinite Loop Issue with Vite + Tailwind v4 + Shopify Development #17227
Replies: 6 comments 2 replies
-
|
I'm having the same issue, though I don't know how Shopify CLI would be triggering tailwind/vite to rebuild. My setup loops even with Shopify CLI not running. |
Beta Was this translation helpful? Give feedback.
-
|
@moxiethunder After finally getting a chance to spend some more time on it this afternoon I believe it to be tailwind itself picking up the newly generated output file and triggering a rebuild. I think it's content detection might be getting greedy here. I've excluded Shopify's assets directory and the looping has stopped. This works with both My CSS entrypoint ( |
Beta Was this translation helpful? Give feedback.
-
|
@import 'tailwindcss' source(none);
@source "../../**/*.{blade.php,blade.md,md,html,vue}";
@source not "../../**/_tmp/*";Update: nope, it didn't work. As an actual solution, I had to use the |
Beta Was this translation helpful? Give feedback.
-
|
I needed to add |
Beta Was this translation helpful? Give feedback.
-
|
Based on the discussion above, here's a comprehensive solution for the Tailwind v4 infinite loop issue with Vite and Shopify: Root CauseThe infinite loop occurs because:
Solution 1: Use
|
Beta Was this translation helpful? Give feedback.
-
|
The infinite loop occurs because Tailwind v4's automatic source detection is picking up your generated output files in the To fix this, you need to explicitly tell Tailwind not to scan your production/assets directory. You can do this directly in your CSS entry point using the Solution 1: Exclude the Assets Folder@import "tailwindcss";
/* Exclude the assets directory from being scanned for classes */
@source not "../../assets";Solution 2: Disable Auto-Scanning (More Precise)If you want full control to prevent any future "greedy" detection, disable automatic scanning and define your source paths manually: @import "tailwindcss" source(none);
/* Manually define only the folders with your source code */
@source "../../**/*.{liquid,js,json}"; |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone! I'm setting up a Shopify development environment using Vite and Tailwind v4 but encountering an infinite build loop issue.
Current Setup
shopify theme dev) to sync with ShopifyThe Issue
My workflow creates an infinite build loop:
vite build --watchcompiles assets to/assetsdirectory/assets(a watched directory)What Works
Suspected Cause
I believe the issue is related to how files are being built and the watch process interaction between Vite, Tailwind v4, and the Shopify CLI.
Has anyone encountered this issue or have suggestions for breaking this loop while maintaining the Vite + Tailwind v4 setup? Happy to provide more details if needed.
Beta Was this translation helpful? Give feedback.
All reactions