Dealing with .node modules using build tools can be complicated. I've encountered similar problems before using esbuild. The author's reply was that you can copy the .node file and change the import path after the bundle. Again, this is complicated, especially Usually cjs will use dynamic paths.
refer to: Incorrect .node module require · Issue #3294 · evanw/esbuild · GitHub

If you want to use a build tool, I recommend using wasm anyway, it works in the browser and nodejs, and the path to introduce wasm is usually explicitly declared manually.

1 Like