leptos-rs / start Goto Github PK
View Code? Open in Web Editor NEWStarter template for use with the Leptos web framework.
License: The Unlicense
Starter template for use with the Leptos web framework.
License: The Unlicense
error on compiling:
Front compiling WASM Error: at
/home/priyanshu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.17/src/compile/front.rs:47:30`
Caused by:
0: at /home/priyanshu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.17/src/compile/front.rs:122:10
1:
it looks like the Rust project used to create this wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:
rust wasm file schema version: 0.2.91
this binary schema version: 0.2.92`
But wasm-bingen 0.2.92 works fine.
Hello,
I noticed some strange behavior and wanted to see what is going on.
I follow the default installation, and after cargo leptos watch
I open it in Firefox and the counter does not work:
There is an error: Uncaught (in promise) LinkError: import object field '__wbg_instanceof_ShadowRoot_b64337370f59fe2d' is not a Function
However, in Chromium the counter works
Does anyone have any idea what is happening? :)
When i run 'trunk serve --open --features csr'
I get the following error
Error: error getting canonical path to source HTML file "index.html"
if i add in the default index.html from trunks README to the root of the directory
<!doctype html>
<html>
<head>
<link data-trunk rel="rust" data-wasm-opt="z" />
<link data-trunk rel="icon" type="image/ico" href="/assets/favicon.ico" />
</head>
<body></body>
</html>
then try the command again i get the following warnings
warning: output filename collision.
The bin target `leptos_start` in package `leptos_start v0.1.0 (/home/icy/development/rust/workspace/leptos-portfolio/testprojet)` has the same output filename as the lib target `leptos_start` in package `leptos_start v0.1.0 (/home/icy/development/rust/workspace/leptos-portfolio/testprojet)`.
Colliding filename is: /home/icy/development/rust/workspace/leptos-portfolio/testprojet/target/wasm32-unknown-unknown/debug/leptos_start.wasm
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
warning: output filename collision.
The bin target `leptos_start` in package `leptos_start v0.1.0 (/home/icy/development/rust/workspace/leptos-portfolio/testprojet)` has the same output filename as the lib target `leptos_start` in package `leptos_start v0.1.0 (/home/icy/development/rust/workspace/leptos-portfolio/testprojet)`.
Colliding filename is: /home/icy/development/rust/workspace/leptos-portfolio/testprojet/target/wasm32-unknown-unknown/debug/leptos_start.wasm.dwp
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
then my browser opens to an empty page.
am i doing something wrong? I know it says its ill advised to run build with csr but its my intention.
The site does work when i use cargo leptos serve
The link inside .gitignore
states:
If you’re building a non-end product, such as a rust library that other rust packages will depend on, put Cargo.lock in your .gitignore. If you’re building an end product, which are executable like command-line tool or an application, or a system library with crate-type of staticlib or cdylib, check Cargo.lock into git.
There's even a whole FAQ section called]
Why do binaries have Cargo.lock in version control, but not libraries?
Yet .gitignore
in the template says
Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
And the lockfile is not checked in.
Hi there! Really cool project :)
I've succesfully installed the cargo leptos
cli and created a new project using cargo leptos new --git https://github.com/leptos-rs/start
.
The readme skips any command to serve the project itself - the readme should probably also contain some instructions for what to do afterwards.
I kind of assumed cargo leptos watch
would be the next command.
However, after running that, I still don't know where the app itself is hosted:
Finished dev [unoptimized + debuginfo] target(s) in 0.11s
Cargo finished cargo build --package=example --bin=example --target-dir=target/server --no-default-features
Finished dev [unoptimized + debuginfo] target(s) in 0.24s
Cargo finished cargo build --package=example --lib --target-dir=target/front --target=wasm32-unknown-unknown --no-default-features
There's no address or port number. The --help
or readme.md
also doesn't provide a default port. I found 3000 in the source, but that didn't work.
Maybe this issue should be split up in:
cargo leptos watch
and serve
to include link to where it's hosted (already done)cargo leptos watch
in the Readme of the starter template (done in PR #4)Expected to be able to run cargo leptos watch
in a new project
Getting a thread panicked error
cargo install cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start
cd [your project name]
cargo update
cargo leptos watch
RUST_BACKTRACE=1 cargo leptos watch
Finished dev [unoptimized + debuginfo] target(s) in 0.10s
Cargo finished cargo build --package=leptos_start --lib --target-dir=target/front --target=wasm32-unknown-unknown --no-default-features --features=hydrate
thread 'tokio-runtime-worker' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/eran/.cargo/registry/src/github.com-1ecc6299db9ec823/wasm-bindgen-cli-support-0.2.83/src/descriptor.rs:208:15
stack backtrace:
0: rust_begin_unwind
at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/std/src/panicking.rs:575:5
1: core::panicking::panic_fmt
at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:64:14
2: core::panicking::panic_bounds_check
at /rustc/fc594f15669680fa70d255faec3ca3fb507c3405/library/core/src/panicking.rs:147:5
3: wasm_bindgen_cli_support::descriptor::Descriptor::_decode
4: wasm_bindgen_cli_support::descriptor::Function::decode
5: wasm_bindgen_cli_support::descriptor::Descriptor::_decode
6: wasm_bindgen_cli_support::descriptors::execute
7: wasm_bindgen_cli_support::Bindgen::generate_output
8: cargo_leptos::compile::front::front::{{closure}}::{{closure}}
9: tokio::runtime::task::core::Core<T,S>::poll
10: tokio::runtime::task::harness::Harness<T,S>::poll
11: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
12: tokio::runtime::scheduler::multi_thread::worker::Context::run
13: tokio::macros::scoped_tls::ScopedKey<T>::set
14: tokio::runtime::scheduler::multi_thread::worker::run
15: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
16: tokio::runtime::task::core::Core<T,S>::poll
17: tokio::runtime::task::harness::Harness<T,S>::poll
18: tokio::runtime::blocking::pool::Inner::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Error: task 17 panicked
I used following cmd:
cargo install cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start
cd start-project
cargo leptos watch
and it show error:
Error: compile sass/scss: style/main.scss -> @pkg/leptos_start.css at `/Users/xxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.2.5/src/compile/style.rs:52:18`
can you help me?
Am I missing any configurations?
thank you.
Obviously, this is entirely up to you, but I do think imposing permanent license requirements, including attribution, on projects created from a template is a bit onerous.
I went from "oh neat, a template I can use to get started quickly" to "oh, it dropped a LICENSE
file in there, I wonder what it chose for me... oh, I don't mind MIT but now I'm thinking about what license I want to use for this project, rather than what I wanted to build and that feels pretty derailing."
You might consider CC0, instead. And just mention that in the readme and that folks are free to choose their own license for their project, instead of pre-creating a LICENSE
file in the project for them.
Regardless, thanks so much for such a helpful starter template!
Just started testing out Leptos:
$ cargo install trunk cargo-leptos
$cargo leptos new --git https://github.com/leptos-rs/star
And then I do:
$ cargo leptos watch
Or, even:
$ cargo leptos build --release
I get the attached filer errors
build.log
Attempting to follow the https://github.com/leptos-rs/start#executing-a-server-on-a-remote-machine-without-the-toolchain.
When building in release and then running the server, the HTML points to /pkg/leptos_start_bg.wasm
, but the generated file is named /pkg/leptos_start.wasm
.
console:
GET http://localhost:3000/pkg/leptos_start_bg.wasm 404 (Not Found)
HTML:
...
<head>
...
<link rel="preload" href="/pkg/leptos_start_bg.wasm" as="fetch" type="application/wasm" crossorigin="">
...
</head>
...
ls at target/server/release
:
$ ls pkg
leptos_start.css leptos_start.js leptos_start.wasm snippets
Versions:
Steps to reproduce:
# Deps
rustup toolchain install nightly
rustup default nightly
rustup target add wasm32-unknown-unknown
cargo install --locked cargo-generate
npm install -g sass
# init leptos-rs/start
cargo install --locked cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start
cd ${PROJ_NAME}
# Build in release
cargo leptos build --release
cd target/server/release
cp -r ../../site/* .
# Set env vars
LEPTOS_OUTPUT_NAME="leptos_start"
LEPTOS_SITE_ROOT="site"
LEPTOS_SITE_PKG_DIR="pkg"
LEPTOS_SITE_ADDR="127.0.0.1:3000"
LEPTOS_RELOAD_PORT="3001"
# exec
./leptos_start
Versions:
Steps to reproduce:
rustup toolchain install nightly
rustup default nightly
rustup target add wasm32-unknown-unknown
cargo install --locked cargo-generate
npm install -g sass
cargo install --locked cargo-leptos
cargo leptos new --git https://github.com/leptos-rs/start
cd ${PROJ_NAME}
cargo leptos watch
Error log
Error: at `/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.1.11/src/compile/front.rs:46:30`
Caused by:
0: at `/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-leptos-0.1.11/src/compile/front.rs:111:10`
1:
it looks like the Rust project used to create this wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:
rust wasm file schema version: 0.2.86
this binary schema version: 0.2.87
Currently the bindgen format is unstable enough that these two schema versions
must exactly match. You can accomplish this by either updating this binary or
the wasm-bindgen dependency in the Rust project.
You should be able to update the wasm-bindgen dependency with:
cargo update -p wasm-bindgen --precise 0.2.87
don't forget to recompile your wasm file! Alternatively, you can update the
binary with:
cargo install -f wasm-bindgen-cli --version 0.2.86
if this warning fails to go away though and you're not sure what to do feel free
to open an issue at https://github.com/rustwasm/wasm-bindgen/issues!
Related:
Notes:
Looks like this is a reoccurring issue. Would it be possible to add some kind of tooling, that would handle syncing the wasm-bindgen versions between cargo-leptos and the template?
not a pro in this regard, but maybe it is better to write e2e tests in pure Rust?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.