Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use node's createRequire() to get the require function for loadRustLib() #725

Closed
wants to merge 1 commit into from

Conversation

themikelester
Copy link
Collaborator

require does not exist in the global namespace, at least on my machine. According to the node.js docs, it shouldn't. This uses a builtin node function to generate the require function for use within ES modules.

Without this change, I can't run tools such as zww_extractor.ts

See https://nodejs.org/api/esm.html#no-require-exports-or-moduleexports

…ustLib()`

`require` does not exist in the global namespace, at least on my machine. According to the node.js docs, it shouldn't. This uses a builtin node function to generate the `require` function for use within ES modules.

Without this change, I can't run tools such as zww_extractor.ts

See https://nodejs.org/api/esm.html#no-require-exports-or-moduleexports
@themikelester
Copy link
Collaborator Author

Whoops. I didn't realize that loadRustLib() was used by more than just tools. This change won't work in browser environments. So the issue seems to be that we need to support using require in both the browser and node (for tools). I'll work on a better fix.

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.

1 participant