Describe the bug
Version: vite/2.5.7 darwin-x64 node-v16.1.0
Code:
import React from "react";
const fn = <T,>(t: T) => t;
const App: React.FC = () => {
return <div>{fn(12)}</div>;
};
export default App;
Error:
[plugin:vite:esbuild] Transform failed with 1 error:
~/vite-app/src/App.tsx:7:2: error: Unexpected "return"
There was discussion before:
#2295
#2691
And the answer is this is not vite issues: #2295 (comment)
But from that time esbuild is fixes this error: evanw/esbuild#825
And the Code compiles successful with esbuild (0.12.28) with the command: yarn esbuild src/App.tsx --bundle. But not in Vite dev mode.
I not sure what is esbuild version Vite is uses, but probably need to update it.
Reproduction
See example above
System Info
Binaries:
Node: 16.1.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.23.0 - ~/test-app/node_modules/.bin/npm
Browsers:
Chrome: 92.0.4515.107
npmPackages:
vite: ^2.5.7 => 2.5.7
Used Package Manager
yarn
Logs
No response
Validations
Describe the bug
Version:
vite/2.5.7 darwin-x64 node-v16.1.0Code:
Error:
There was discussion before:
#2295
#2691
And the answer is this is not vite issues: #2295 (comment)
But from that time esbuild is fixes this error: evanw/esbuild#825
And the Code compiles successful with esbuild (
0.12.28) with the command:yarn esbuild src/App.tsx --bundle. But not in Vite dev mode.I not sure what is esbuild version Vite is uses, but probably need to update it.
Reproduction
See example above
System Info
Binaries: Node: 16.1.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.23.0 - ~/test-app/node_modules/.bin/npm Browsers: Chrome: 92.0.4515.107 npmPackages: vite: ^2.5.7 => 2.5.7Used Package Manager
yarn
Logs
No response
Validations