web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
10.04k stars 573 forks source link

fix: linux musl resolve failed #8467

Closed jerrykingxyz closed 3 days ago

jerrykingxyz commented 3 days ago

Summary

Some linux musl can not get create time, and it will make resolve failed because of metadata return err.

This PR will specify a default value of 0 for the creation time when the platform does not support it.

Should fix:

Checklist

netlify[bot] commented 3 days ago

Deploy Preview for rspack canceled.

Name Link
Latest commit c000bcd5f5095ebece21ecfa789337e94f8f1977
Latest deploy log https://app.netlify.com/sites/rspack/deploys/673bc8ba07f4060008add755
hardfist commented 3 days ago

why the resolve succeed before and dont get the panic message now

jerrykingxyz commented 3 days ago

why the resolve succeed before and dont get the panic message now

Before https://github.com/web-infra-dev/rspack/pull/8366, We use rspack_resolver::FileMetadata::from with std::fs::Metadata and it does not get the metadata.created() values.

code: https://github.com/web-infra-dev/rspack/pull/8366/files#diff-bf8cd6ecce0c487ed3834f3fa4e20f4bdde318d99fc6f2ff75a49a6e08307948L22

Currently we will convert std::fs::Metadata -> rspack_fs::FileMetadata -> rspack_resolver::FileMetadata, and this error occurs during the first conversion.