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

v4: Vite build fails on Cloudflare #15399

Closed
MickL opened this issue Dec 14, 2024 · 3 comments · Fixed by #15404
Closed

v4: Vite build fails on Cloudflare #15399

MickL opened this issue Dec 14, 2024 · 3 comments · Fixed by #15404
Assignees

Comments

@MickL
Copy link

MickL commented Dec 14, 2024

What version of Tailwind CSS are you using?

4.0.0-beta.7

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

tailwindcss: 4.0.0-beta.7
vite: 6.0.3

What version of Node.js are you using?

Node: 22.11.0
Bun: 1.1.38

Reproduction URL

https://github.com/MickL/tailwind-vite

Describe your issue

Build works fine on my system (macOS) but when deploying to Cloudflare Pages I get the following error:

23:07:02.897 | Executing user command: bun run build
23:07:03.104 | $ vite build
23:07:03.768 | vite v6.0.3 building for production...
23:07:03.829 | transforming...
23:07:03.834 | ✓ 1 modules transformed.
23:07:03.840 | x Build failed in 40ms
23:07:03.840 | error during build:
23:07:03.840 | [@tailwindcss/vite:generate:build] Object not disposable
23:07:03.841 | file: /opt/buildhome/repo/index.css
23:07:03.841 | at q (file:///opt/buildhome/repo/node_modules/@tailwindcss/vite/dist/index.mjs:1:66)
23:07:03.841 | at P (file:///opt/buildhome/repo/node_modules/@tailwindcss/vite/dist/index.mjs:1:270)
23:07:03.841 | at Object.transform (file:///opt/buildhome/repo/node_modules/@tailwindcss/vite/dist/index.mjs:1:3715)
23:07:03.841 | at Object.handler (file:///opt/buildhome/repo/node_modules/vite/dist/node/chunks/dep-yUJfKD1i.js:50845:15)
23:07:03.841 | at file:///opt/buildhome/repo/node_modules/rollup/dist/es/shared/node-entry.js:20812:40
23:07:03.847 | error: script "build" exited with code 1
23:07:03.850 | Failed: Error while executing user command. Exited with error code: 1
23:07:03.858 | Failed: build command exited with code: 1
23:07:04.505 | Failed: error occurred while running build command
@rgripper
Copy link

This is because a call to dispose with using keyword fails on Node v20. But it starts working on Node v22

@MickL
Copy link
Author

MickL commented Dec 15, 2024

Cloudflare is using Node 18 for its build process.

I can confirm that it is working with Node 22. As a workaround one can add an environment variable NODE_VERSION or a file .nvmrc with the content 22.12.0 to specify Node version for the build process as described here

@RobinMalfait
Copy link
Member

Hey!

This should be fixed by #15404, and will be available in the next beta release. As a temporary workaround, if you can bump Node.js to at least 18.20.x it should work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants