Skip to content

[bug] on_web_resource_request not working in dev mode #5708

@matthme

Description

@matthme

Describe the bug

In dev mode, i.e. when running npm run tauri dev the method on_web_resource_request of the WundowBuilder seems to be ignored.

Reproduction

  1. Run sh <(curl https://create.tauri.app/sh) on linux.
  2. Choose npm as the package manager and Vue-ts as the frontend framework.
  3. Add the following setup hook to src-tauri/src/main.rs:
        .setup(|app| {
            use tauri::WindowBuilder;
            use tauri::WindowUrl;
            let _window = WindowBuilder::new(
                &app.handle(),
                String::from("some_label"),
                WindowUrl::App("index.html".into()),
            ).on_web_resource_request(move |request, response| {
              println!("Received request: {:?}", request);
            }).build();

            Ok(())
        })

  1. Run npm run tauri dev and see that the print statement is not being triggered.
  2. Build the app via npm run tauri build and see that the print statement is being triggered when running the AppImage.

Expected behavior

I expect .on_web_resource_request() to also work in dev mode.

Platform and versions

Environment
› OS: Ubuntu 22.04 X64
› Node.js: 16.11.1
› npm: 8.0.0
› pnpm: Not installed!
› yarn: 1.22.19
› rustup: 1.25.1
› rustc: 1.64.0
› cargo: 1.64.0
› Rust toolchain: stable-x86_64-unknown-linux-gnu

Packages
› @tauri-apps/cli [NPM]: 1.2.1
› @tauri-apps/api [NPM]: 1.2.0
› tauri [RUST]: 1.2.1,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.6,
› wry [RUST]: 0.22.5,

App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:1420/
› framework: Vue.js

App directory structure
├─ dist
├─ node_modules
├─ src-tauri
├─ src
├─ .vscode
└─ public

Stack trace

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions