stackblitz / webcontainer-core

Dev environments. In your web app.
https://webcontainers.io
MIT License
3.73k stars 140 forks source link

Error creating a new app from template React TypeScript (Cannot use JSX unless the '--jsx' flag is provided.(17004)) #1465

Closed luisjunco closed 6 days ago

luisjunco commented 1 month ago

Describe the bug

Hi,

when you create a new app with the template "React TypeScript", the app runs but the editor is showing this TypeScript error (screenshot attached):

Cannot use JSX unless the '--jsx' flag is provided.(17004)

This error appears right from the beginning (i.e., without making any changes to the code or configuration).

Link to the blitz that caused the error

https://stackblitz.com/edit/vitejs-vite-gfg6bq?file=src%2FApp.tsx

Steps to reproduce

Expected behavior

I'd expect the template to work without errors from the beginning and without having to touch ts config files.

Parity with Local

Screenshots

image

Platform

Browser name  = Chrome
Full version  = 125.0.0.0
Major version = 125
navigator.appName = Netscape
navigator.userAgent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
performance.memory = {
  "totalJSHeapSize": 349900517,
  "usedJSHeapSize": 336120645,
  "jsHeapSizeLimit": 2172649472
}
Hash = 9e2d28a3

Additional context

Note: I had to mark the checkbox "I have run the project in my local machine" (it seems to be a required field, can not submit the form template without marking it). However, I have only tested on the web version.

MrZhouZh commented 1 month ago

same issue~ image

elson-currentcorp commented 3 weeks ago

+1 also encountering same issue

BlessYAHU commented 2 weeks ago

The tsconfig.json file in default Reactjs project template references tsconfig.app.json which has the compiler option, but doesn't seem to be picked up. When I put the the jsx compiler option in tsconfig.json, the issue was resolved.

Here is a fresh empty project with the compiler option added to the tsconfig.json.

I'm not saying this is the solution, just what I discovered. Hopefully this helps shed some light on the issue.

alexalannunes commented 2 weeks ago

it works for me put this in tsconfig.json

 "compilerOptions": {
    "jsx": "react-jsx"
  },
SamVerschueren commented 6 days ago

We are aware of this issue and we have a fix for it. I will try to get it released today.

SamVerschueren commented 6 days ago

This is now released. If you run into any other issues with the fix, let us know so we can address them.