Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3720872
D6784.id22731.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6784.id22731.diff
View Options
diff --git a/keyserver/addons/rust-node-addon/index.js b/keyserver/addons/rust-node-addon/index.js
--- a/keyserver/addons/rust-node-addon/index.js
+++ b/keyserver/addons/rust-node-addon/index.js
@@ -1,6 +1,9 @@
// @flow
+import { createRequire } from 'module';
+
const { platform, arch } = process;
+const require = createRequire(import.meta.url);
type RustAPI = {
+registerUser: (
@@ -16,16 +19,16 @@
let nativeBinding = null;
if (platform === 'darwin' && arch === 'x64') {
// $FlowFixMe
- nativeBinding = await import('./napi/rust-node-addon.darwin-x64.node');
+ nativeBinding = require('./napi/rust-node-addon.darwin-x64.node');
} else if (platform === 'darwin' && arch === 'arm64') {
// $FlowFixMe
- nativeBinding = await import('./napi/rust-node-addon.darwin-arm64.node');
+ nativeBinding = require('./napi/rust-node-addon.darwin-arm64.node');
} else if (platform === 'linux' && arch === 'x64') {
// $FlowFixMe
- nativeBinding = await import('./napi/rust-node-addon.linux-x64-gnu.node');
+ nativeBinding = require('./napi/rust-node-addon.linux-x64-gnu.node');
} else if (platform === 'linux' && arch === 'arm64') {
// $FlowFixMe
- nativeBinding = await import('./napi/rust-node-addon.linux-arm64-gnu.node');
+ nativeBinding = require('./napi/rust-node-addon.linux-arm64-gnu.node');
} else {
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`);
}
@@ -34,7 +37,7 @@
throw new Error('Failed to load native binding');
}
- const { registerUser } = nativeBinding.default;
+ const { registerUser } = nativeBinding;
return { registerUser };
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 9, 12:53 PM (4 h, 33 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2835107
Default Alt Text
D6784.id22731.diff (1 KB)
Attached To
Mode
D6784: [keyserver] Fix rust-node-addon after deprecation of --experimental-specifier-resolution=node
Attached
Detach File
Event Timeline
Log In to Comment