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

Compatibility issue between @preact/preset-vite 2.8.3 and vite 2.9.18 #130

Closed
12joan opened this issue Jun 26, 2024 · 4 comments
Closed
Labels
needs-more-info Issue needs more information to be able to resolve it

Comments

@12joan
Copy link

12joan commented Jun 26, 2024

I encountered a build error when upgrading my app from @preact/preset-vite 2.8.2 to 2.8.3. Upgrading vite from 2.9.18 to 5.x fixed the issue, despite 2.x being listed as a supported version.

For some reason, I'm unable to reproduce the issue in a clean project, so there must be something specific to my project's code or configuration that's causing the error. Here's a snapshot of my code prior to upgrading.

yarn build output
#11 [6/6] RUN yarn build
#11 0.298 yarn run v1.22.22
#11 0.321 $ vite build
#11 0.667 vite v2.9.18 building for production...
#11 0.713 transforming...
#11 0.732 ✓ 2 modules transformed.
#11 0.732 [vite:esbuild] Transform failed with 1 error:
#11 0.732 /app/node_modules/esbuild/lib/main.js:241:12: ERROR: Invalid option in transform() call: "jsxImportSource"
#11 0.732 file: /app/client/src/main.tsx:241:12
#11 0.732 
#11 0.732 Invalid option in transform() call: "jsxImportSource"
#11 0.732 
#11 0.732 
#11 0.732 error during build:
#11 0.732 Error: Transform failed with 1 error:
#11 0.732 /app/node_modules/esbuild/lib/main.js:241:12: ERROR: Invalid option in transform() call: "jsxImportSource"
#11 0.732     at failureErrorWithLog (/app/node_modules/esbuild/lib/main.js:1605:15)
#11 0.732     at /app/node_modules/esbuild/lib/main.js:1428:20
#11 0.732     at /app/node_modules/esbuild/lib/main.js:666:9
#11 0.732     at handleIncomingPacket (/app/node_modules/esbuild/lib/main.js:763:9)
#11 0.732     at Socket.readFromStdout (/app/node_modules/esbuild/lib/main.js:632:7)
#11 0.732     at Socket.emit (node:events:520:28)
#11 0.732     at addChunk (node:internal/streams/readable:559:12)
#11 0.732     at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
#11 0.732     at Readable.push (node:internal/streams/readable:390:5)
#11 0.732     at Pipe.onStreamRead (node:internal/stream_base_commons:191:23)
#11 0.749 error Command failed with exit code 1.
#11 0.749 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
#11 ERROR: process "/bin/sh -c yarn build" did not complete successfully: exit code: 1
@rschristian
Copy link
Member

rschristian commented Jun 26, 2024

It's probably #114, but our CI runs on 2.9.16 and reports no issues.

Edit: I can't reproduce this in this repo or anywhere else on v2.9.18. We'll need a minimal reproduction.

@rschristian rschristian added the needs-more-info Issue needs more information to be able to resolve it label Jun 26, 2024
@rschristian
Copy link
Member

rschristian commented Jul 3, 2024

It looks like you had some ancient versions of esbuild in your lock file:

https://github.com/anderbellstudios/triangles/blob/7e2fb9589f390fa11ee2212fbc28370ee00c36cd/yarn.lock#L1096-L1097

We're running 0.14.54 here without issue, the jsxImporSource feature probably came out between our two versions.

You could've bumped it to avoid touching Vite.

@12joan
Copy link
Author

12joan commented Jul 3, 2024

Thanks! I wouldn't have spotted that myself. Strange that my dependency autoupdater didn't catch that.

@rschristian
Copy link
Member

Perhaps your dependency autoupdater only updates direct dependencies? Vite depends on ESBuild, you don't use it directly, so I'm guessing that is the reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-more-info Issue needs more information to be able to resolve it
Projects
None yet
Development

No branches or pull requests

2 participants