Skip to content
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

Upstream tailwindcss 4.0.0-alpha.25 is broken #12880

Closed
jmooring opened this issue Sep 25, 2024 · 6 comments
Closed

Upstream tailwindcss 4.0.0-alpha.25 is broken #12880

jmooring opened this issue Sep 25, 2024 · 6 comments

Comments

@jmooring
Copy link
Member

jmooring commented Sep 25, 2024

This works:

  "devDependencies": {
    "@tailwindcss/cli": "4.0.0-alpha.24",
    "tailwindcss": "4.0.0-alpha.24"
  },

This fails:

  "devDependencies": {
    "@tailwindcss/cli": "4.0.0-alpha.25",
    "tailwindcss": "4.0.0-alpha.25"
  },

Alpha 25 was released yesterday:
https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.0-alpha.25

I am suspicious of this change:
tailwindlabs/tailwindcss#14446

To reproduce:

git clone https://github.com/bep/hugo-testing-tailwindcss-v4
cd hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/
npm install
hugo
build log
Start building sites … 
hugo v0.135.0-DEV-0ea796dad11e5d9f5b4c96a8e65f8272c9e4ccb5+extended linux/amd64 BuildDate=2024-09-22T14:53:11Z

Total in 315 ms
Error: error building site: TAILWINDCSS: failed to transform "/css/styles.css" (text/css): /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:564
			const error = new Error("Can't " + message);
			              ^

Error: Can't resolve 'tailwindcss' in '/home/jmooring/temp/hugo-testing-tailwindcss-v4'
    at finishWithoutResolve (/home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:564:18)
    at /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:656:15
    at /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (/home/jmooring/temp/hugo-testing-tailwindcss-v4/tailwindcss-cli-simple/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1) {
  details: "resolve 'tailwindcss' in '/home/jmooring/temp/hugo-testing-tailwindcss-v4'\n" +
    '  Parsed request is a module\n' +
    '  No description file found in /home/jmooring/temp/hugo-testing-tailwindcss-v4 or above\n' +
    '  resolve as module\n' +
    "    /home/jmooring/temp/hugo-testing-tailwindcss-v4/node_modules doesn't exist or is not a directory\n" +
    "    /home/jmooring/temp/node_modules doesn't exist or is not a directory\n" +
    "    /home/jmooring/node_modules doesn't exist or is not a directory\n" +
    "    /home/node_modules doesn't exist or is not a directory\n" +
    "    /node_modules doesn't exist or is not a directory"
}

Node.js v20.11.1

I can get 4.0.0-alpha.25 to work by adding an explicit mount:

[[module.mounts]]
source = 'assets'
target = 'assets'

[[module.mounts]]
source = 'node_modules/tailwindcss'
target = 'assets/css/tailwindcss'

And then changing the initial import statement from:

@import "tailwindcss";

To:

@import "tailwindcss/index.css";

Given that we can make this work, perhaps we should address this in the documentation, the example repository, and in the integration test.

@bep bep self-assigned this Sep 26, 2024
@bep bep removed the NeedsTriage label Sep 26, 2024
@bep
Copy link
Member

bep commented Sep 26, 2024

Given that we can make this work, perhaps we should address this in the documentation, the example repository, and ...

I suggest adding a note with a reference to THIS issue and nothing more. We need to fix this and I don't want the above slightly ugly workaround somehow be how it's done around the web; then we fix it and the workaround stops working ... Also, this is alpha software.

@bep bep added this to the v0.134.4 milestone Sep 26, 2024
@bep
Copy link
Member

bep commented Sep 26, 2024

Seems like the TailwindCLI's reading from stdin is broken in the latest alpha.

This fails:

tailwindcss  --input=- -o /Users/bep/dump/foo.css < assets/css/styles.css  

This works:

tailwindcss  -i assets/css/styles.css -o /Users/bep/dump/foo.css

I will try to find a workaround.

bep added a commit to bep/hugo that referenced this issue Sep 26, 2024
As a workaround for what seems to be a bug in  tailwindcss 4.0.0-alpha.25.

See gohugoio#12880
@bep
Copy link
Member

bep commented Sep 26, 2024

#12881 works for me; if you can take it for a spin and confirm, I can make it into a patch release, as I know there are many Hugo alpha tailwind users out there.

Also, I will create a upstream bug.

bep added a commit to bep/hugo that referenced this issue Sep 26, 2024
As a workaround for what seems to be a bug in  tailwindcss 4.0.0-alpha.25.

See gohugoio#12880
@bep bep added the Upstream label Sep 26, 2024
@bep
Copy link
Member

bep commented Sep 26, 2024

Upstream issue: tailwindlabs/tailwindcss#14521

bep added a commit to bep/hugo that referenced this issue Sep 26, 2024
As a workaround for what seems to be a bug in  tailwindcss 4.0.0-alpha.25.

See gohugoio#12880
@bep bep changed the title css.TailwindCSS not compatible with tailwindcss 4.0.0-alpha.25 Upstream tailwindcss 4.0.0-alpha.25 is broken Sep 26, 2024
bep added a commit that referenced this issue Sep 27, 2024
@jmooring
Copy link
Member Author

jmooring commented Oct 6, 2024

This was fixed upstream with tailwindcss 4.0.0-alpha.26.

@jmooring jmooring closed this as completed Oct 6, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants