tauri-apps / tauri

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

[bug] Scope not defined for window `main` and URL #8468

Closed JQiue closed 9 months ago

JQiue commented 9 months ago

Describe the bug

This error occurs in my old projects, even when I create new ones

image

{
  "name": "chinglish",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "preview": "vite preview",
    "tauri:dev": "tauri dev"
  },
  "dependencies": {
    "vue": "^3.3.4",
    "@tauri-apps/api": "^1.5.2"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^4.2.3",
    "typescript": "^5.0.2",
    "vite": "^5.0.0",
    "vue-tsc": "^1.8.5",
    "@tauri-apps/cli": "^1.5.8"
  }
}
{
  "build": {
    "beforeDevCommand": "pnpm dev",
    "beforeBuildCommand": "pnpm build",
    "devPath": "http://localhost:1420",
    "distDir": "../dist"
  },
  "package": {
    "productName": "chinglish",
    "version": "0.0.0"
  },
  "tauri": {
    "allowlist": {
      "all": false,
      "shell": {
        "all": false,
        "open": true
      }
    },
    "bundle": {
      "active": true,
      "targets": "all",
      "identifier": "com.chinglish",
      "icon": [
        "icons/32x32.png",
        "icons/128x128.png",
        "icons/128x128@2x.png",
        "icons/icon.icns",
        "icons/icon.ico"
      ]
    },
    "security": {
      "csp": null
    },
    "windows": [
      {
        "fullscreen": false,
        "resizable": true,
        "title": "chinglish",
        "width": 800,
        "height": 600
      }
    ]
  }
}

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.19045 X64
    ✔ WebView2: 120.0.2210.91
    ✔ MSVC: Visual Studio ���ɹ��� 2022
    ✔ rustc: 1.73.0 (cc66ad468 2023-10-03)
    ✔ cargo: 1.73.0 (9c4383fb5 2023-08-26)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default) 
    - node: 18.17.1
    - pnpm: 8.11.0
    - yarn: 1.22.19
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 1.5.4
    - tauri-build [RUST]: 1.5.1
    - wry [RUST]: 0.24.7
    - tao [RUST]: 0.16.5
    - @tauri-apps/api [NPM]: 1.5.3
    - @tauri-apps/cli [NPM]: 1.5.9

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: Vue.js
    - bundler: Vite

Stack trace

No response

Additional context

No response

JQiue commented 9 months ago

I should add that the address of the vite server is not requested for each startup

image

amrbashir commented 9 months ago

As explained by the error you need to configure https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess

JQiue commented 9 months ago

As explained by the error you need to configure https://tauri.app/v1/api/config/#securityconfig.dangerousremotedomainipcaccess

I configured it and got rid of the error, but when I started with 'dev', why didn't I request the local development address

image

This is true for all of my tauri projects

amrbashir commented 9 months ago

From the screenshot, I think you have some code that navigates to dict.youdao.com but without seeing a reprouction repo, it is hard to pin point the problem.