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.tomlcompatibility_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:
- Log into the Cloudflare dashboard and select your account.
- Select Pages and select your Pages project.
- Select Settings > Functions > Compatibility Flags.
- Configure your Production and Preview compatiblity flags as needed.