diff --git a/cli/src/api/templates/js-binding.ts b/cli/src/api/templates/js-binding.ts index 652702ee..48555172 100644 --- a/cli/src/api/templates/js-binding.ts +++ b/cli/src/api/templates/js-binding.ts @@ -274,6 +274,35 @@ switch (platform) { loadError = e } break + case 'riscv64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, '${localName}.linux-riscv64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./${localName}.linux-riscv64-musl.node') + } else { + nativeBinding = require('${pkgName}-linux-riscv64-musl') + } + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, '${localName}.linux-riscv64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./${localName}.linux-riscv64-gnu.node') + } else { + nativeBinding = require('${pkgName}-linux-riscv64-gnu') + } + } catch (e) { + loadError = e + } + } + break default: throw new Error(\`Unsupported architecture on Linux: \${arch}\`) }