You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
11.15.08 [vite] Internal server error: Transform failed with 1 error:
C:/Users/name/project/src/main.tsx:6:2: ERROR: Expected ";" but found "as"
Plugin: vite:esbuild
File: C:/Users/name/project/src/main.tsx:6:1
Expected ";" but found "as"
4 | const brokenFunction = () => {
5 | foo: 'bar'
6 | } as {foo: 'bar';};| ^
7 |
8 | const Broken = () => {
at failureErrorWithLog (C:\Users\name\project\node_modules\esbuild\lib\main.js:1651:15)
at C:\Users\name\project\node_modules\esbuild\lib\main.js:849:29
at responseCallbacks.<computed> (C:\Users\name\project\node_modules\esbuild\lib\main.js:704:9)
at handleIncomingPacket (C:\Users\name\project\node_modules\esbuild\lib\main.js:764:9)
at Socket.readFromStdout (C:\Users\name\project\node_modules\esbuild\lib\main.js:680:7)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
11.15.08 [vite] Pre-transform error: Transform failed with 1 error:
C:/Users/name/project/src/main.tsx:6:2: ERROR: Expected ";" but found "as"
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Describe the bug
Vite breaks when trying to run the pre-transform step on the following code:
This throws the following error
From the error log, it seems that at some point, the parentheses wrapping the object have been removed, which causes the broken syntax.
I have tested this on the vanilla-ts and react-ts templates, but it's only broken in the react-ts template, i don't know about any other framework.
Reproduction
https://stackblitz.com/edit/vitejs-vite-fdiygv
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
Full error log!
Validations
The text was updated successfully, but these errors were encountered: