Skip to content

"Cannot create proxy" error building Vite + Tailwind v4 app with Cloudflare plugin #9379

Closed
@crrobinson14

Description

@crrobinson14

What versions & operating system are you using?

@cloudflare/vite-plugin v1.2.4, vite v6.3.5, @tailwindcss/vite v4.1.7

Please provide a link to a minimal reproduction

Reproduction Repro

NOTE: See the comment in vite.config.ts.npm run build works when the plugin is commented out, and breaks when it's active. I did the scaffold and Cloudflare plugin installation in two separate commits. You can see the change by comparing HEAD vs the previous commit.

Describe the Bug

I have a Vite project with a Tailwind v4 config. Running npm run build works locally. But after adding the cloudflare() plugin to vite.config.ts per https://developers.cloudflare.com/workers/vite-plugin/tutorial/#set-up-and-configure-the-react-spa, I receive this error:

error during build:
[@tailwindcss/vite:generate:build] Cannot create proxy with a non-object as target or handler
file: [REDACTED]/apps/web/src/index.css

This error text was reported separately here TanStack/router#4132 but it appears as though while the causes may be the same, the actual issue is different. That report was an issue in tanstack-router related to the new Vite "Environment API" and their issue was fixed in a recent release. Perhaps the same fix is required here? (To be clear: this is not a current issue in tanstack-router, and the repro above does not install it.)

Please provide any relevant error logs

Just the error reported above, on the console.

Metadata

Metadata

Assignees

Labels

bugSomething that isn't workingvite-pluginRelating to the `@cloudflare/vite-plugin` package

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions