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
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.
For automatic runtime, Vite uses babel to transform JSX and esbuild to transform TS.
// inputnamespaceAAA{exportconstHello=()=><div>Hello</div>}// output from babelnamespaceAAA{exportconstHello=()=>/*#__PURE__*/_jsxDEV("div",{children: "Hello"},void0,false,{fileName: _jsxFileName,lineNumber: 5,columnNumber: 30},this);_c=Hello;}
This output uses this in namespace and esbuild throws an error for that. Vite needs to inject a custom babel plugin to babel to transform this this to void 0. vitejs/vite#9590 might fix this indirectly.
For classic runtime, Vite uses babel to add debug information and esbuild to transform JSX+TS.
// inputnamespaceAAA{exportconstHello=()=><div>Hello</div>}// output from babelnamespaceAAA{exportconstHello=()=><div__self={this}__source={{fileName: _jsxFileName,lineNumber: 5,columnNumber: 30}}>Hello</div>;
_c=Hello;}
We need to use a similar babel plugin for this case too.
Describe the bug
Jsx in namespace is not supported, similar to this bug: #22413
Reproduction
pnpm create vite demo --template react-ts
Steps to reproduce
https://stackblitz.com/edit/vitejs-vite-o1zmeh?file=src%2FApp.tsx&terminal=dev
Create a official demo:
pnpm create vite demo --template react-ts
.And then write the following code:
System Info
Used Package Manager
pnpm
Logs
This error occured:
Validations
The text was updated successfully, but these errors were encountered: