fix(cli): log more wasi load errors (#1943)

This commit is contained in:
LongYinan 2024-02-08 21:54:34 +08:00 committed by GitHub
commit da2f412d79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -328,14 +328,18 @@ switch (platform) {
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
try {
nativeBinding = require('./${localName}.wasi.cjs')
} catch {
// ignore
} catch (err) {
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
}
}
if (!nativeBinding) {
try {
nativeBinding = require('${pkgName}-wasm32-wasi')
} catch (err) {
console.error(err)
if (process.env.NAPI_RS_FORCE_WASI) {
console.error(err)
}
}
}
}