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

Enable nodejs_compat by default for new projects created by C3 #8310

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

irvinebroque
Copy link
Contributor

refs #7388

We've gone back and forth on this in the past — but in practice, have found that:

  1. People are most successful in getting started when nodejs_compat is enabled. Hit the ground running, and NPM packages you want to use are more likely to work.
  2. When nodejs_compat is not enabled by default for new projects, products like Hyperdrive, or tutorials that use any NPM packages, need to explain extra steps and caveats to developers. Steps that are easy to miss, or misunderstand.

Getting the ecosystem using shared standards is important. That's why WinterTC exists, why all the awesome work that @jasnell and others do matters. How we get there is by working with WinterTC and the broader community — not by holding back nodejs_compat to developers getting started building Workers. The whole point is that developers and open-source maintainers shouldn't have to navigate a maze of differences — and enabling nodejs_compat for new projects furthers that goal.

We're going to keep making nodejs_compat better, more native to the Workers Runtime, and more comprehensive. And listen to what the vast majority of people want and expect when starting new projects. Disabling nodejs_compat is just one line of configuration to remove :)

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: Don't think anything tests what compat flags enabled
  • Wrangler E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: ?
  • Public documentation
    • TODO (before merge) — @thomasgauvin if any docs you think we should cover this in
    • Cloudflare docs PR(s):
    • Documentation not necessary because:

Copy link

changeset-bot bot commented Feb 28, 2025

🦋 Changeset detected

Latest commit: a479da7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-wrangler-8310

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/8310/npm-package-wrangler-8310

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-wrangler-8310 dev path/to/script.js
Additional artifacts:

cloudflare-workers-bindings-extension:

wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-workers-bindings-extension-8310 -O ./cloudflare-workers-bindings-extension.0.0.0-v60c7bd564.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v60c7bd564.vsix

create-cloudflare:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-create-cloudflare-8310 --no-auto-update

@cloudflare/kv-asset-handler:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-kv-asset-handler-8310

miniflare:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-miniflare-8310

@cloudflare/pages-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-pages-shared-8310

@cloudflare/unenv-preset:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-unenv-preset-8310

@cloudflare/vite-plugin:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-vite-plugin-8310

@cloudflare/vitest-pool-workers:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-vitest-pool-workers-8310

@cloudflare/workers-editor-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-workers-editor-shared-8310

@cloudflare/workers-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-workers-shared-8310

@cloudflare/workflows-shared:

npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/13596487290/npm-package-cloudflare-workflows-shared-8310

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.111.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20250214.1
workerd 1.20250214.0 1.20250214.0
workerd --version 1.20250214.0 2025-02-14

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@thomasgauvin
Copy link
Contributor

I would lean towards all docs that require nodejs_compat to avoid errors should include it in the steps, even if nodejs_compat becomes a default, in case for some reason, someone has a cloudflare worker without nodejs compat enabled. So I would lean towards leaving https://developers.cloudflare.com/hyperdrive/get-started/#enable-nodejs-compatibility (maybe switch 'Enable' to 'Ensure') and I think we should still merge cloudflare/cloudflare-docs#19860

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

4 participants