Skip to content

Commit b15f399

Browse files
committed
Fix wasm
1 parent 2dcb782 commit b15f399

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/file_system.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ impl FileSystem for FileSystemOs {
213213
}
214214

215215
async fn metadata(&self, path: &Path) -> io::Result<FileMetadata> {
216+
// This implementation is verbose because there might be something wrong node wasm runtime.
217+
// I will investigate it in the future.
218+
if let Ok(m) = std::fs::metadata(path).map(FileMetadata::from) {
219+
return Ok(m);
220+
}
221+
222+
self.symlink_metadata(path).await?;
223+
let path = self.canonicalize(path).await?;
216224
std::fs::metadata(path).map(FileMetadata::from)
217225
}
218226

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ impl<Fs: FileSystem + Send + Sync> ResolverGeneric<Fs> {
263263

264264
let package_json =
265265
cached_path.find_package_json(&self.cache.fs, &self.options, ctx).await?;
266-
// FIXME: something wrong with [std::fs::metadata] in wasm
267-
#[cfg(not(target_arch = "wasm32"))]
268266
if let Some(package_json) = &package_json {
269267
// path must be inside the package.
270268
debug_assert!(path.starts_with(package_json.directory()));

0 commit comments

Comments
 (0)