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

Fail more gracefully on partially Node.js compatible runtime environments #25

Open
lovell opened this issue Aug 24, 2024 · 1 comment
Open

Comments

@lovell
Copy link
Owner

lovell commented Aug 24, 2024

Some JavaScript runtime environments have limitations/assumptions, for example:

"Node.js APIs are available under the node: prefix, and this prefix must be used when importing modules, both in your code and the npm packages you depend on." https://developers.cloudflare.com/workers/runtime-apis/nodejs/

We could improve support for these environments by failing more gracefully.

For example, when requireing Node.js modules, an alternative "safe require" function could be used that tries e.g. child_process then node:child_process then otherwise returns null. Failure to require a module should probably lead to APIs also returning null.

Ideally we'll be able to add an integration test for this e.g. by running Wrangler "locally" within CI.

See also #24 for some previous discussion.

@AmeerArsala
Copy link

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants