DioxusLabs / DioxusLabs/dioxus

Symlinked assets regression

Open
#3,422 0 comments 0 reactions 0 assignees View on GitHub
bug cli
Dominant language
Rust
Stars
39.1k
Forks
1.9k
Avg merge
4d 10h
Merged PRs (30d)
4

Description

**Problem**

Because of https://github.com/DioxusLabs/dioxus/issues/3410, I had to make a full copy of the project in an adjacent directory, where everything is symlinked to `../original-project/`, except for `Cargo.toml` and now with v0.6.1 — `tailwind.css` (actually all explicitly used assets). I'm pretty sure it's because Dioxus checks fully resolved absolute path, which is indeed outside of the checked crate, so it gives this:

```rs
13:08:21 [dev] Full rebuild: triggered manually
13:08:22 [cargo] error: Asset path /path/to/project/assets/favicon.ico is invalid. Make sure the asset exists within this crate
--> src/main.rs:28:24
|
28 | const FAVICON: Asset = asset!("/assets/favicon.ico");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `asset` (in Nightly builds, run with -Z macro-backtrace for more info

13:08:22 [cargo] error: Asset path /path/to/project/assets/styling/main.css is invalid. Make sure the asset exists within this crate
--> src/main.rs:29:25
|
29 | const MAIN_CSS: Asset = asset!("/assets/styling/main.css");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `asset` (in Nightly builds, run with -Z macro-backtrace for more info

13:08:22 [cargo] error: Asset path /path/to/project/assets/styling/tailwind.css is invalid. Make sure the asset exists within this crate
--> src/main.rs:30:29
|
30 | const TAILWIND_CSS: Asset = asset!("/assets/styling/tailwind.css");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `asset` (in Nightly builds, run with -Z macro-backtrace for more info

13:08:23 [cargo] error: could not compile `desktop` (bin "desktop") due to 3 previous errors; 2 warnings emitted
```

**Steps To Reproduce**

Steps to reproduce the behavior:

- `dx new test`
- `mkdir test-copy`
- `fd -d 1 -E target '' test -X ln -sr '{}' test-copy`
- `cd test-copy`
- `dx serve`

**Expected behavior**

I used this project with v0.6.0 and didn't have such issues.

**Screenshots**

**Environment:**
- Dioxus version: v0.6.1
- Rust version: rustc 1.83.0-nightly (fb4aebddd 2024-09-30)
- OS info: Pop!_OS 22.04
- App platform: desktop

**Questionnaire**

I'm interested in fixing this myself but don't know where to start.
I would like to fix and I _think_ have a solution.
I don't have time to fix this right now, but maybe later.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.