I just built a web application repository using React/TypeScript, the application works, but the deployment fails:
> build:dev > SNOWPACK_PUBLIC_APP_ENVIRONMENT=dev snowpack build [@snowpack/plugin-typescript] src/api/runtime.ts(130,24): error TS2304: Cannot find name 'GlobalFetch'. [@snowpack/plugin-typescript] Error: Command failed with exit code 2: tsc --noEmit src/api/runtime.ts(130,24): error TS2304: Cannot find name 'GlobalFetch'.
The strange thing is that the project is running on another machine, so it is not a new development and there are no source code changes. The SO answer to "GlobalFetch" says there is a problem in some 3.x versions of the type script, but I see the installed version has a higher version:
Version "4.2.3"
Any ideas on where to look for the cause?
P粉0557261462023-09-14 09:15:30
GlobalFetch
The type has been removed from the definition in TS 3.6.
Your other development environments may use older versions of TS.
You either have to
GlobalFetch
type in the code basedeclare type GlobalFetch = WindowOrWorkerGlobalScope