#Tauri 2 & Sveltekit (Svelte 5)

14 messages · Page 1 of 1 (latest)

jovial mauve
#

I followed the guides for Tauri 2, but the app shows a blank page with the following error:

Unhandled Promise Rejection: SyntaxError: Unexpected token '='
(anonymous function) — client.js:305
promiseReactionJob
Module Code — client.ts:19

await (pending_invalidate ||= Promise.resolve());

It runs fine in other browsers. It seems like there is an issue with Promise or possibly top-level await.
Is there a switch for Tauri to have top-level await available in the webview?

willow pier
#

Is there a switch for Tauri to have top-level await available in the webview?
Nope, that's up to the webview. What's your os and os version?

jovial mauve
#

MacOS Catalina.
I was afraid that might be the main issue of Tauri - the entropy of different OS Webviews, but it's good it happens now on my dev device instead of getting tons of opaque errors from users later.

honest grotto
jovial mauve
#

First: Thanks for the quick help guys!
I tried setting many different target configs in vite, but for some reason it does not seem to respect and transpile it correctly.

///vite.config.js
export default defineConfig({
    plugins: [sveltekit()],
    build: {
        target: ['es2020', 'safari13'],
    },
    esbuild: {
        target: ['es2020', 'safari13'],
    },
honest grotto
#

Does this problem affect only dev mode or also builds?

jovial mauve
#

I know it's not directly related to tauri, but there were other dev stories of similar problems due to different webview issues of OSes which lies at the base of tauri's approach so that I think I need to skip tauri.

jovial mauve
honest grotto
willow pier
#

with recent vite versions you may need the legacy plugin for safari13 nowadays but afaik that's only for production (same for the targets you set i think) so dev is still annoying

jovial mauve
jovial mauve