Open Mutefish0 opened 2 months ago
require('xxx.node') will get error missing symbol called after deno compile.
require('xxx.node')
missing symbol called
deno 1.45.1 (release, aarch64-apple-darwin) v8 12.7.224.12 typescript 5.5.2
copy file audio.node: https://github.com/Mutefish0/deno-node-addons-issue/blob/master/audio.node
audio.node
create main.ts
main.ts
import Module from 'node:module' import path from "node:path"; const standalone = Deno.args.includes("--standalone"); export function resolvePath(url: string, metaUrl: string) { let baseDir = ""; if (standalone) { baseDir = path.dirname(Deno.execPath()); } else { baseDir = path.dirname(metaUrl); } baseDir = baseDir.replace("file://", ""); return path.resolve(baseDir, url); } const mod = new Module('') const url = resolvePath("./audio.node", import.meta.url); if (Deno.statSync(url).isFile) { const m = mod.require(url); console.log(m); }
compile and run:
deno compile --allow-ffi --allow-read --output ./main ./main.ts --standalone ./main
then the error occurs:
deno run:
deno run --allow-ffi --allow-read ./main.ts
works fine:
reproduce repo: https://github.com/Mutefish0/deno-node-addons-issue
Reopen the issue since the PR(https://github.com/denoland/deno/pull/24642) was reverted. @devsnek Can this PR get relanded or is there any plan to address this issue?
require('xxx.node')
will get errormissing symbol called
after deno compile.Version:
Reproduce
copy file
audio.node
: https://github.com/Mutefish0/deno-node-addons-issue/blob/master/audio.nodecreate
main.ts
compile and run:
then the error occurs:
deno run:
works fine:
reproduce repo: https://github.com/Mutefish0/deno-node-addons-issue