-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[v4] Tailwind fails to compile if there is no parent directory #15987
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
Comments
Hey! Thanks for the issue and the PR, this will be available in the next release. |
DenysKarmazynDFINITY
added a commit
to dfinity/oisy-wallet
that referenced
this issue
Feb 20, 2025
# Motivation ## Problem After migrating to Tailwind 4, building OISY via Docker was no longer possible due to the issue on the screenshot below. Investigation showed that there was a problem with transforming files that contain tailwind classes. [The function that was throwing the error](https://github.com/tailwindlabs/tailwindcss/blob/main/crates/oxide/src/scanner/allowed_paths.rs#L111) implied that we somehow try to parse some unexpected by tailwind files. Also, there were [some complains](tailwindlabs/tailwindcss#15987) on the exact same issue recently. <img width="573" alt="Screenshot 2025-02-19 at 18 28 41" src="https://github.com/user-attachments/assets/b8be362a-3d52-44b8-ab4a-bfa3cdef2641" /> ## Solution Apparently, the previous way of specifying content for parsing in Tailwind.config file doesn't work in the 4th version. Instead, we need to set [the base path](https://tailwindcss.com/docs/detecting-classes-in-source-files#setting-your-base-path) when importing tailwindcss module. After adding the `source` directive, `npm run build` works in both local and Docker environment. Also, it explains why we suddenly started seeing CSS warning that were coming from `e2e` folder - Tailwind was trying to process files outside of `src`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Tailwind CSS are you using?
v4
What build tool (or framework if it abstracts the build tool) are you using?
Nextjs 15.6.1
What version of Node.js are you using?
v22.9.0
What browser are you using?
N/A
What operating system are you using?
macOS but running in Docker with node:alpine
Reproduction URL
All thats required is tailwind v4 and a Dockerfile without a
WORKDIR
. Ive created a public repo that showcases the issue.https://github.com/eirikhanasand/tailwindnoparentdirbug
Describe your issue
When using tailwindcss in a Docker container without a WORKDIR statement tailwind will panic at
crates/oxide/src/scanner/detect_sources.rs:117:78
due to callingOption::unwrap()
on aNone
value as it fails to find a parent directory:tailwindcss/crates/oxide/src/scanner/detect_sources.rs
Line 117 in f237f59
The text was updated successfully, but these errors were encountered: