Skip to content

Conversation

@CGQAQ
Copy link

@CGQAQ CGQAQ commented Apr 9, 2024

This PR fixes the situation that:

  • node esm mode using createRequire to require node-bindings
  • deno import npm:node-bindings, make it working with Deno

@TooTallNate
Copy link
Owner

How are you running as ESM? Do you use a bundler?

@CGQAQ
Copy link
Author

CGQAQ commented Apr 9, 2024

there're two options in Nodejs:

  • .mjs suffix
  • type: module in package.json

In deno, it only support esm, but it can import commonjs packages through npm: modifier

codesandbox

  • esm file path in stacktrace is file url
  • cjs file path in stacktrace is platform path( / seperated on mac/linux, \ seperated on windows )
image

@CGQAQ
Copy link
Author

CGQAQ commented Apr 9, 2024 via email

@CGQAQ CGQAQ changed the title fix: not working properly on esm mode fix: not working properly on esm mode, specifically in Deno Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants