vite icon indicating copy to clipboard operation
vite copied to clipboard

The typescripe project compiled by vite cannot run normally on safari, but it can run normally on chrome

Open zw201913 opened this issue 1 year ago • 5 comments

Describe the bug

https://github.com/tauri-apps/create-tauri-app/issues/87 image Then I start the project through the command about npm run tauri dev, but it gives an error when rendering。 image Below is info of npm run tauri info: image image Below is struct of the project: image

image

Reproduction

npm create vite@latest

System Info

Below is info of `npm run tauri info`:
<img width="380" alt="image" src="https://user-images.githubusercontent.com/16849315/180134132-f8c1d14c-bc8d-4436-8fe6-110462c993b0.png">
<img width="247" alt="image" src="https://user-images.githubusercontent.com/16849315/180134285-250df6f7-66bf-4427-8aa3-6ca777415fe9.png">

it is ok in chrome:
<img width="1211" alt="image" src="https://user-images.githubusercontent.com/16849315/181007749-16f1993f-5ce3-4df2-bab6-18732538da02.png">
it is not ok in safari,the safari‘s version is 13.0.3 (13608.3.10.10.1)
<img width="1224" alt="image" src="https://user-images.githubusercontent.com/16849315/181008275-f96fd4ef-4191-4874-868f-84def821a4f7.png">

Used Package Manager

npm

Logs

No response

Validations

zw201913 avatar Jul 28 '22 14:07 zw201913

What Vite version are you using? This should be fixed in latest wit https://github.com/vitejs/vite/pull/9315. Otherwise your code may be using ?. optional chaining which Vite doesn't transpile by default if it's in JS.

bluwy avatar Jul 29 '22 08:07 bluwy

vite/3.0.2 darwin-x64 node-v16.16.0

zw201913 avatar Jul 29 '22 09:07 zw201913

vite/3.0.2 darwin-x64 node-v16.16.0

zw201913 avatar Jul 29 '22 09:07 zw201913

Can you try Vite 3.0.3 or 3.0.4?

bluwy avatar Jul 29 '22 09:07 bluwy

Vite 3.0.3 image

zw201913 avatar Jul 29 '22 15:07 zw201913

@zw201913 globalThis is supported by Safari 13.0.3. So that error shouldn't be happening.

Would you paste the result of npx envinfo --system --npmPackages '{vite,@vitejs/*}' --binaries --browsers?

sapphi-red avatar Jul 31 '22 14:07 sapphi-red

image

zw201913 avatar Jul 31 '22 15:07 zw201913

Ummm, I think this is a bug in Safari or tauri. Or tauri is using Safari other than 13.0.3.

sapphi-red avatar Jul 31 '22 15:07 sapphi-red

Does opening localhost:5173 by Safari work?

sapphi-red avatar Jul 31 '22 15:07 sapphi-red

Yes! success in Safari image

image

zw201913 avatar Jul 31 '22 15:07 zw201913

Then, I think tauri is using a different version of Safari.

Closing as this is not a bug in Vite. (Vite doesn't support old browsers during dev)

sapphi-red avatar Jul 31 '22 15:07 sapphi-red