fix(tauri): use raw __TAURI_INTERNALS__ invoke, fix dynamic import on Android
Root cause: dynamic import('@tauri-apps/plugin-opener') silently fails on
Android Tauri WebView because the module resolution path for @tauri-apps/api
(plugin dependency) differs from npm expectations in the bundled context.
Rewrote tauri.ts to use window.__TAURI_INTERNALS__.invoke() directly:
- openUrl() → invoke('plugin:opener|open_url', {url})
- setupDeepLinkHandler() → invoke('plugin:deep-link|get_current')
- Warm-start listener still uses import('@tauri-apps/api/event') for
deep-link://new-url events (bundled as separate chunk by Vite)
- Added @tauri-apps/api as direct dependency
Also kept withGlobalTauri: true (needed for __TAURI_INTERNALS__ injection)
but reverted APK frontendDist back to bundled React app (../web/dist)
since redirect-to-live-web approach was unreliable.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
"version": "0.1.0",
|
||||
"identifier": "com.zeavis.edu",
|
||||
"build": {
|
||||
"frontendDist": "../web/dist-tauri",
|
||||
"frontendDist": "../web/dist",
|
||||
"devUrl": "http://localhost:5173",
|
||||
"beforeBuildCommand": "echo 'Nothing to build (APK loads live web content)'",
|
||||
"beforeDevCommand": "echo 'Dev mode - connect to localhost:5173'"
|
||||
"beforeBuildCommand": "cd ../web && bun run build",
|
||||
"beforeDevCommand": "cd ../web && bun run dev"
|
||||
},
|
||||
"app": {
|
||||
"withGlobalTauri": true,
|
||||
|
||||
Reference in New Issue
Block a user