Skip to content
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] error ReferenceError: navigator is not defined #7383

Closed
hhtower opened this issue Jul 8, 2023 · 1 comment
Closed

[bug] error ReferenceError: navigator is not defined #7383

hhtower opened this issue Jul 8, 2023 · 1 comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@hhtower
Copy link

hhtower commented Jul 8, 2023

Describe the bug

error info:

  • error node_modules@tauri-apps\api\chunk-V5J25SYE.js (1:13) @ n
  • error ReferenceError: navigator is not defined

the key code (react):
import { appWindow } from "@tauri-apps/api/window";
register(keys.join("+"), () => {
appWindow.show();
appWindow.setFocus();
});

useEffect(() => {
console.log("registerKey init", typeof window )
if(clientConfig?.isApp) {
registerKey(keyStore.get() || []);
}
});

Reproduction

No response

Expected behavior

No response

Platform and versions

tauri: 1.4.0
react: 18.2.0
next: 13.4.6

Stack trace

No response

Additional context

No response

@hhtower hhtower added status: needs triage This issue needs to triage, applied to new issues type: bug labels Jul 8, 2023
@amrbashir
Copy link
Member

duplicate of #6226 and many others

Tauri api package is not intended to be used in server side code, as in next.js or other SSR frameworks. If you must use an SSR frameworks, either guard the import in a client side code, by using await import or disable the SSR capabilites.

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants