-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] meta tag redirects break production build #3887
Comments
The content of the configured distDir gets copied into the binary itself.
Do you mean the right click menu doesn't open or the devtools? How responsive is the window in general?
The thing is that we have quite many users using sveltekit (and svelte in general, which tbh seems easier to integrate into tauri from what i've heard) |
@FabianLars Thanks for the quick response! Wow, I didn't know that the contents are copied into the binary. I guess I assumed it was similar to Electron, where the web assets are stored in the The right click menu does open, but clicking "Inspect Element" does nothing. The native UI controls of the window are fully responsive, but the main window remains white, with both "Inspect Element" and "Reload" seemingly doing nothing. I suspected that maybe a local server isn't being run to host the Screen.Recording.2022-04-11.at.5.33.09.PM.mov |
Are you doing anything in rust except for the standard boilerplate code? |
@JonasKruckenberg I am not... that said, I did some digging and it looks like the issue is originating from the fact I am using a server-side redirect from my cc. @FabianLars |
I'd like to see a reproduction example to the inspector not opening issue too if that's possible. I'm investigating the original issue right now. |
@Nickersoft the first problem here is that when you start the app, Tauri tries to load the Here's the full contents of <script lang="ts" context="module">
export const prerender = true;
export async function load() {
return {
status: 302,
redirect: '/main.html'
};
}
</script> |
@lucasfernog Thanks for looking into this! How might this be handled when using Hopefully that makes sense – I can try updating the repro repo, but it might take some time seeing I'd need to spoof an authentication flow. |
Maybe we can improve our asset loader but this is a little tricky since SvelteKit uses SSR, I'll make more tests. |
I'd need to take a look at your auth redirection code but I think you won't be able to use the SSR You can also keep your The devserver isn't touched by Tauri so you'd need to set it up properly. |
Ah yeah, so I just updated my reproduction with an authentication example. After some toying around, it looks like you can't prerender pages when handling auth flows, because the authentication state is dynamic and needs to be resolved on page load via a dispatch to Is the recommended approach to then just have your Tauri app show a webview that loads your website hosted on a remote server? That, or run your own Node server locally instead of using Tauri's built-in one, as I don't think SvelteKit's static output can handle auth? |
As I said you won't be able to use the SSH capabilities with the static build that Tauri needs. You can eithe resolve the auth check in the client side or try using tauri-plugin-localhost removing the static adapter, which should behave similar to |
Ah, I didn't know there was a localhost plugin! I'll take a look. Thanks again for all the help :) |
Describe the bug
Hey all,
I'm currently experimenting with bundling a SvelteKit application with Tauri using the
@sveltejs/adapter-static
adapter. My adapter builds all of my resources to abuild
directory in my project folder, which I can then view withyarn preview
. However, when I runtauri build
to build a production version of my app, opening it results in a white screen.Upon checking the macOS app contents, there is only an
info.plist
file, aresources/icon.icns
file, and my application binary. The debug version of the production app (using--debug
) won't let me use "Inspect Element" either. I click it and nothing opens.Despite all this, running
tauri dev
spins up my dev server and opens a preview application that loads just fine. Not sure what could be going wrong in the bundling step. Tauri can obviously see mybuild
directory, because when I change the path the build step errors.Here's my current config:
I minimally modified the config from what was generated when I first made my project... am I doing something wrong, or is this a bug?
Reproduction
I don't have a reproduction repo to share, but from what I assume, creating an empty SvelteKit project, then adding Tauri to, then running a production build should reproduce the issue.
Expected behavior
I would expect the production build to function the same as the development preview.
Platform and versions
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: