Update typescript config related with isolatedModules
in new project templates
#17443
Closed
7 tasks done
Labels
Describe the bug
The
tsconfig
file needs to be updated for newtypescript
project templates.With the current configuration, the application may compile successfully but fail at runtime. To fix this, we only need to add
"moduleDetection": "force"
in thecompilerOptions
.More info here:microsoft/TypeScript#55785
Reproducible example here:https://stackblitz.com/edit/vitejs-vite-srbrdd
Reproduction
https://stackblitz.com/edit/vitejs-vite-srbrdd?file=tsconfig.json
Steps to reproduce
ts
file inside thesrc
folder (for examplenewfile.ts
) with this content:const MY_CONST = 1
App.tsx
:{MY_CONST}
,At this point, you should be able to compile (with
npx tsc --noEmit
) or build the app (npm run build
) without errors, but the app fails at runtime (npm run dev
) in the preview.To fix this, we only need to add
"moduleDetection": "force"
in thecompilerOptions
.System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: