From 6f29371973fbaf5ebaaf976d1d59bb50add1f4c8 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 28 Dec 2023 00:58:30 +0200 Subject: [PATCH] Use CommonJS modules which support addon loading --- index.js | 7 +++---- package.json | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index b5a0e16..d72ff0c 100644 --- a/index.js +++ b/index.js @@ -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'); } diff --git a/package.json b/package.json index 4555c05..a925d38 100644 --- a/package.json +++ b/package.json @@ -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",