Cloudflare Docs
Workers
Visit Workers on GitHub
Set theme to dark (⇧+D)

Node.js compatibility

The following APIs from Node.js are available directly in the Workers runtime. To enable these APIs in your Worker, add the nodejs_compat compatibility flag to your wrangler.toml:

wrangler.toml
compatibility_flags = [ "nodejs_compat" ]

​​ Pages Functions

If you are using Pages Functions, set compatibility flags using the Pages-specific CLI commands. To set Pages compatibility flags in the Cloudflare dashboard:

  1. Log into the Cloudflare dashboard and select your account.
  2. Select Pages and select your Pages project.
  3. Select Settings > Functions > Compatibility Flags.
  4. Configure your Production and Preview compatiblity flags as needed.