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

docs: update Cloudflare Workers instructions #796

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

Cherry
Copy link
Contributor

@Cherry Cherry commented Jan 30, 2024

With Cloudflare Workers, node_compat is an old paradigm that injects a lot of things into the global namespace that aren't necessary here, and existed before Cloudflare had more native support for Node.js APIs.

nodejs_compat is much more modern and Cloudflare's solution for actually using Node.js modules, and what this library uses when it imports from things like node:events, etc.

The tests referenced for the Cloudflare implementation here also use nodejs_compat, not node_compat:

// npx wrangler@latest pages dev ./cf --script-path test.js --compatibility-date=2023-06-20 --log-level=debug --compatibility-flag=nodejs_compat

I've tested with many of my own projects, and only nodejs_compat is needed. You in fact can't use both the older node_compat and newer nodejs_compat, so I would recommend encouraging use of the newer paradigm here.

@porsager porsager merged commit 3623021 into porsager:master Jan 30, 2024
30 checks passed
@Cherry Cherry deleted the patch-1 branch January 30, 2024 20:43
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