vite-plugin-cloudflare: ERROR: Invalid option in build() call: "jsxSideEffects" Vite v4

Hey folks,

Great plugin! Been trying to get it to work with my custom Vite development server without much success so far. While trying to figure that out however, I upgraded to the latest version of Vite (4.0) and realized that this breaks the plugin in a different way:

error when starting dev server:
Error: Build failed with 1 error:
/Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:244:12: ERROR: Invalid option in build() call: "jsxSideEffects"
    at failureErrorWithLog (/Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:1624:15)
    at /Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:1143:18
    at /Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:1138:9
    at /Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:678:9
    at handleIncomingPacket (/Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:775:9)
    at Socket.readFromStdout (/Users/alexturpin/src/vpc-test/node_modules/vite-plugin-cloudflare/node_modules/esbuild/lib/main.js:644:7)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)

Also if anyone has successfully integrated this with a custom dev server, any tips? Even on Vite 3. Getting this error:

ReferenceError: Cannot access 'seenIds' before initialization
    at Object.delayDepsOptimizerUntil (file:///Users/alexturpin/src/vpc-test/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:41492:55)
    at doTransform (file:///Users/alexturpin/src/vpc-test/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:36846:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

sure, i’ll add this to the docs.

Ah yes sorry my bad, I had put the full error in my repo README but not here 😅 Installing esbuild ourselves does seem to fix it, thank you. 🙏

Shouldn’t esbuild be a dependency of vite-plugin-cloudflare in this case, just like in 0.2.0? If it makes its own use of it, and requires a specific version as well. Or at the very least a peer dependency? It seems to me this would happen to new users on a fresh install without too much warning otherwise.