fix: refine openExternalUrl to correctly import Tauri shell plugin based on environment
This commit is contained in:
@@ -3,10 +3,11 @@
|
|||||||
* @param url The URL to open
|
* @param url The URL to open
|
||||||
*/
|
*/
|
||||||
export const openExternalUrl = async (url: string): Promise<void> => {
|
export const openExternalUrl = async (url: string): Promise<void> => {
|
||||||
if (typeof window !== 'undefined' && (window as any).__TAURI__) {
|
// Only include Tauri shell import in Tauri builds
|
||||||
|
// @ts-ignore
|
||||||
|
if (import.meta.env.VITE_TAURI) {
|
||||||
try {
|
try {
|
||||||
// @ts-ignore
|
const { open } = await import('@tauri-apps/plugin-shell');
|
||||||
const { open } = await import(/* @vite-ignore */ '@tauri-apps/plugin-shell');
|
|
||||||
await open(url);
|
await open(url);
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user