I'm working on a simple Svelte app, using Vite as a build tool, which works fine on my desktop browsers (Chrome/Edge alike), but when trying to browse the dev build (pnpm dev --host
) on a mobile device (either an Android simulator or my iPhone) it doesn't work:
It looks like the ES support is different, or Vite doesn't transpile this code further to a compatible version for those browsers. The same ?.nickname
expression works fine in desktop.
I also tried changing target to ES2015 in tsconfig.json
but the .svelte file in the browser doesn't change...
Any ideas?
You can find support for ?.
or Optional chaining here.
The support is widespread so unless you are testing legacy mobile phones it should work. I suspect there is something wrong with your emulator then.