Use CommonJS modules which support addon loading
This commit is contained in:
parent
7333754bb2
commit
6f29371973
7
index.js
7
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');
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue
Block a user