Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tauri+leptos+leptonic gives a compilation error #52

Open
aptly-io opened this issue Mar 9, 2024 · 5 comments
Open

tauri+leptos+leptonic gives a compilation error #52

aptly-io opened this issue Mar 9, 2024 · 5 comments

Comments

@aptly-io
Copy link

aptly-io commented Mar 9, 2024

I wanted to try tauri with leptos and this leptonic library. I go through these steps:

sh <(curl https://create.tauri.app/sh)    # choosing tauri-leptos as name, cargo/rust and leptos
✔ Project name · tauri-leptos
✔ Choose which language to use for your frontend · Rust - (cargo)
✔ Choose your UI template · Leptos - (https://leptos.dev/)

cd tauri-leptos

# I want to use components from leptonic, I don't really care if it uses client or server side-rendering
# (I follow leptonic's doc's on custom installation):

cargo add leptonic --features clipboard,tiptap

cargo tauri dev

During the compilation I notice the following error (the tauri demo screen shows up empty white)

   Compiling leptos_meta v0.6.9
        Warn Waiting for your frontend dev server to start on http://localhost:1420/...                                                                                                                                                      
error[E0599]: no method named `clipboard` found for struct `Navigator` in the current scope
   --> /home/francis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/leptonic-0.5.0/src/typography.rs:199:29
    |
199 |             match navigator.clipboard() {
    |                             ^^^^^^^^^ method not found in `Navigator`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `leptonic` (lib) due to 1 previous error
2024-03-09T13:06:38.998522Z ERROR ❌ error
error from build pipeline

Caused by:
    0: HTML build pipeline failed (1 errors), showing first
    1: error from asset pipeline
    2: error during cargo build execution
    3: cargo call to executable 'cargo' with args: '["build", "--target=wasm32-unknown-unknown", "--manifest-path", "/home/francis/dev/projects/tauri/tauri-leptos/Cargo.toml"]' returned a bad status: exit status: 101
2024-03-09T13:06:38.999658Z  INFO 📡 serving static assets at -> /

Is there something I'm doing wrong in the way to use leptonic in tauri-leptos? Thank you!

PS it works without the clipboard feature. I can copy from and paste to the tauri window. Do one really need the clipboard feature? What benefit does it offer?

@lpotthast
Copy link
Owner

Hey, I have never used Tauri. But I think demand for it might be high enough that an additional template could be a good idea.

To your error specifically: Do you have a .cargo dir with a config.toml containing

[build]
rustflags = ["--cfg=web_sys_unstable_apis"]

This is necessary for the Clipboard feature. Documentation should definitely reflect this better!

@aptly-io
Copy link
Author

aptly-io commented Mar 9, 2024

Thank you. What you mean is to put together a leptonic-template-tauri? That would be awesome! I look forward to that!

I think some way forward for me now (as a rust beginner) is to maybe start off with the tauri-leptos scaffold-ed project and replace the front-end demo code with your leptonic-template-csr.

I tried to add the AppBar inside that scaffold-ed code. And that angered the compiler. Feels too difficult with my current rustc/cargo understanding to fix. It seems easier to try to glue 2 working projects together ...

@lpotthast
Copy link
Owner

Can you try out this template: https://github.com/lpotthast/leptonic-template-tauri

@lpotthast
Copy link
Owner

Make sure to install the cli for Tauri v2 with cargo install tauri-cli@2.0.0-beta.8

@aptly-io
Copy link
Author

aptly-io commented Mar 9, 2024

Thanks you! Well done! I could start on both the Linux desktop and Android emulator!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants