-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Revert "Fix importing @tauri-apps/api
in Node.js"
#3767
Conversation
This reverts commit d36c8e0.
I must admit, I have not been following along with this, but the problem of the original PR was that it introduced unexpected behavior correct? Edit: Also, @amrbashir just a heads up that your commit is not signed |
It was trying to solve regular imports in SSR environments like SvelteKit.
Yeah, if your SSR server is running on Linux and your app is running on Windows,
you'd think github would sign your commits when clicking "revert" on a commit but they don't 🥲. |
The problem is that the PR checks what OS it's running in Node.js, which could result in that OS being used as part of SSR, and it could result in incorrect The point of the PR was to prevent errors when importing I don't know if I agree that this is unexpected behavior though. If Node.js happened to have the same API as browsers, would we have to deliberately detect if we're running Node.js and throw an error to prevent unexpected behavior? |
No, We shouldn't care about Node.js at all because it is not the actual runtime and maybe your SSR is using another runtime like deno or Bun.js and we shouldn't care about them either. Our current published api will throw an error because window is undefined and that is enough, that is the expected behavior and users should know by then that this API should be used client side. All we need to do is to point them to a FAQ and that's it. |
I agree with Amr here. I totally missed this point on the other PR. |
I agree that SSR/SSG support is nothing the API should be overly concerned with. It might communicate the wrong things to users too if it did. But wouldn't adding a |
Sure, adding a |
Reverts #3752