tauri-apps / tauri-apps/tauri-docs

Inlined plugins

Open
#2,680 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
MDX
Stars
1.1k
Forks
887
Avg merge
2d 8h
Merged PRs (30d)
48

Description

tauri version:2
I have a custom plugin(not a lib package,just a rs file with some commands), in the rs file,there is an init function like below:

// custom.rs
pub fn init() -> TauriPlugin<Wry> {
    Builder::new("custom")
        .invoke_handler(generate_handler![test_command])
        .build()
}

and inner the main.rs

// main.rs
fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_process::init())
        .plugin(tauri_plugin_dialog::init())
        .plugin(tauri_plugin_clipboard_manager::init())
        .plugin(tauri_plugin_os::init())
        .plugin(tauri_plugin_shell::init())
        .plugin(tauri_plugin_notification::init())
        .plugin(tauri_plugin_fs::init())
        .plugin(tauri_plugin_global_shortcut::Builder::new().build())
        .plugin(tauri_plugin_http::init())
        // custom plugin
        .plugin(custom::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

but i can't invoke this command from frontend.


  await invoke(plugin::custom|test_command);

Error from frontend:Unhandled Promise Rejection: custom:test_command not allowed. Plugin not found.

and i can't add this custom command to capability too.

In the previous version tauri V1, I could invoke custom command using this way.
so,what i should do for this in v2?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the custom.rs init function and main.rs registration shown in the report, then compare the Tauri v2 command-invocation and capability documentation. Clarify the supported way to expose an inlined custom plugin command from the frontend and the relevant capability configuration; done when the v1-to-v2 migration path and the reported custom:test_command failure are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rust
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.