Use CommonJS modules which support addon loading

This commit is contained in:
Anton Liaposhchenko 2023-12-28 00:58:30 +02:00
parent 7333754bb2
commit 6f29371973
2 changed files with 3 additions and 5 deletions

View File

@ -1,13 +1,12 @@
let module;
try {
module = await import('./index.node');
module.exports = require('./index.node');
} catch {
const isLinux = process.platform === 'linux';
if (isLinux && process.arch === 'x64') {
module = await import('./index-x86_64-unknown-linux-gnu.node');
module.exports = require('./index-x86_64-unknown-linux-gnu.node');
} else if (isLinux && process.arch === 'arm64') {
module = await import('./index-aarch64-unknown-linux-gnu.node');
module.exports = require('./index-aarch64-unknown-linux-gnu.node');
} else {
throw new Error('Bliss: unsupported architecture');
}

View File

@ -1,6 +1,5 @@
{
"name": "@bliss-rs/bliss-rs",
"type": "module",
"version": "1.0.0",
"description": "A fork of the bliss-rs library with Node.js bindings",
"main": "index.js",