You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when specifying a base_path in Dioxus.toml, it is baked into the WASM at compile time, making all asset paths absolute. This creates issues for local development because:
If a base_path is set, serving the app locally (dioxus serve) does not work correctly from localhost, since asset paths are incorrect unless the app is served from its intended subdirectory.
There is no way to specify base_path dynamically (e.g., via an environment variable), meaning developers must modify Dioxus.toml before each build to support different environments.
This problem affects not just cases where the base_path is unknown ahead of time, but any situation where an app is deployed under a subdirectory rather than the root. It seems like a common issue for anyone using Dioxus in such a setup.
Implementation Suggestion
A few possible solutions to address this issue:
Allow base_path to be specified via an environment variable (DIOXUS_BASE_PATH)
This would enable different values for development vs. production without modifying Dioxus.toml in build scripts.
Support relative paths for base_path
If base_path = "./" or similar could be interpreted relative to the served HTML file rather than the root, that would allow flexible deployments.
Introduce a base_path override for local builds
Some fields in Dioxus.toml already support a different value for local builds—this could be extended to base_path, defaulting to / when running dioxus serve.
Would love to hear thoughts on whether this could be supported in the near future as it would avoid an ugly workaround in an app template I'm working on for https://freenet.org/.
The text was updated successfully, but these errors were encountered:
Feature Request
Currently, when specifying a
base_path
inDioxus.toml
, it is baked into the WASM at compile time, making all asset paths absolute. This creates issues for local development because:base_path
is set, serving the app locally (dioxus serve
) does not work correctly fromlocalhost
, since asset paths are incorrect unless the app is served from its intended subdirectory.base_path
dynamically (e.g., via an environment variable), meaning developers must modifyDioxus.toml
before each build to support different environments.This problem affects not just cases where the
base_path
is unknown ahead of time, but any situation where an app is deployed under a subdirectory rather than the root. It seems like a common issue for anyone using Dioxus in such a setup.Implementation Suggestion
A few possible solutions to address this issue:
Allow
base_path
to be specified via an environment variable (DIOXUS_BASE_PATH
)Dioxus.toml
in build scripts.Support relative paths for
base_path
base_path = "./"
or similar could be interpreted relative to the served HTML file rather than the root, that would allow flexible deployments.Introduce a
base_path
override for local buildsDioxus.toml
already support a different value for local builds—this could be extended tobase_path
, defaulting to/
when runningdioxus serve
.Would love to hear thoughts on whether this could be supported in the near future as it would avoid an ugly workaround in an app template I'm working on for https://freenet.org/.
The text was updated successfully, but these errors were encountered: