Fix outdir not work when run dx bundle --platform web --outdir mydir (#3572)

* Make legacy asset dir optional
* properly implement outdir

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
Co-authored-by:  Nathy-bajo <bajon7680@gmail.com>
This commit is contained in:
authored and GitHub committed 2025-01-16 15:17:33 -08:00
1 parent db16de15c5
commit 19d5fae12d
9 files changed
+152 -143

No files matched your search

+7 -3
View File
@@ -154,8 +154,12 @@ impl BuildRequest {
// If the path is absolute, make it relative to the current directory before we join it
// The path is actually a web path which is relative to the root of the website
let path = path.strip_prefix("/").unwrap_or(path);
let asset_dir_path = self.krate.legacy_asset_dir().join(path);
if let Ok(absolute_path) = asset_dir_path.canonicalize() {
let asset_dir_path = self
.krate
.legacy_asset_dir()
.map(|dir| dir.join(path).canonicalize());
if let Some(Ok(absolute_path)) = asset_dir_path {
let absolute_crate_root = self.krate.crate_dir().canonicalize().unwrap();
PathBuf::from("./")
.join(absolute_path.strip_prefix(absolute_crate_root).unwrap())
@@ -179,7 +183,7 @@ impl BuildRequest {
ResourceType::Script => "web.resource.script",
};
tracing::debug!(
tracing::warn!(
"{RESOURCE_DEPRECATION_MESSAGE}\nTo migrate to head components, remove `{section_name}` and include the following rsx in your root component:\n```rust\n{replacement_components}\n```"
);
}