tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
85.36k stars 2.58k forks source link

[bug] [v2] [android] [windows] Nuxt.js based android app - Cannot redefine property & tauri.localhost #11722

Open gkkirilov opened 3 days ago

gkkirilov commented 3 days ago

Describe the bug

The result is an android emulator with white screen and few errors, the desktop app is working correctly

11-18 01:50:55.088 20184 20184 E Tauri/Console: File: - Line 138 - Msg: Uncaught TypeError: Cannot redefine property: postMessage 11-18 01:50:55.088 20184 20184 E Tauri/Console: File: - Line 2 - Msg: Uncaught TypeError: Cannot redefine property: metadata 11-18 01:50:55.089 20184 20184 E Tauri/Console: File: - Line 25 - Msg: Uncaught TypeError: Cannot redefine property: __TAURI_PATTERN__ 11-18 01:50:55.089 20184 20184 E Tauri/Console: File: - Line 5 - Msg: Uncaught TypeError: Cannot redefine property: path

Also I found out that on the android device the tauri.localhost URL is not working with nuxt and returning 500, as the URLs resources are loaded from are incorrect and inputting manually the localhost:3000 moves us further into the process.

Reproduction

https://github.com/gkkirilov/mobile-test

Clone npm install npx tauri android dev

Open web inspector for android from chrome://inspect/#devices change the URL to localhost:3000 See errors in console

Expected behavior

To show the content of the app on the android emulator

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 130.0.2849.80
    ✔ MSVC: 
        - Visual Studio Build Tools 2017
        - Visual Studio Build Tools 2019
        - Visual Studio Build Tools 2022
        - Visual Studio Community 2022
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.11.1
    - yarn: 1.22.21
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.1.1
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.8
    - tauri-cli 🦀: 2.1.0
    - @tauri-apps/api : not installed!
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-log 🦀: 2.0.2
    - @tauri-apps/plugin-log : not installed!

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:3000/
    - framework: Vue.js (Nuxt)
    - bundler: Webpack

Stack trace

No response

Additional context

Will test on a Mac in the next hour to see if the result is the same

FabianLars commented 3 days ago

Just so the team doesn't close this, we're aware that the redefine errors likely come from https://github.com/tauri-apps/wry/pull/1418 not being released yet. This shouldn't cause a white screen though and is also irrelevant to the url thing.