leptos-rs / start-actix

Starter template for use with the Leptos web framework.
The Unlicense
122 stars 31 forks source link

Running 'trunk serve --open --features csr' fails #31

Closed Aidan-Chelig closed 1 year ago

Aidan-Chelig commented 1 year ago

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

gbj commented 1 year ago

Having tried to reproduce this etc. it seems that this line

<link data-trunk rel="rust" data-wasm-opt="z" />

is what is causing the blank screen. Not sure what's going on there, but if you just remove that from your index.html it works fine.

Aidan-Chelig commented 1 year ago

Thanks so much that fixed it!