Skip to content

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

@12joan

Description

@12joan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-more-infoIssue needs more information to be able to resolve it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions