Node.js compatibility
Node.js is a popular JavaScript runtime for building server-side apps, offering access to system resources and core modules like fs
, path
, and http
. Many npm packages depend on these modules or other Node.js-specific APIs.
Edge environments, such as Webflow Cloud, run code closer to users for better speed, scalability, and security. Instead of full Node.js support, Webflow Cloud relies on Web APIs such as fetch
, Request
, and Response
. While Workers runtime compatibility with Node.js APIs is improving, key differences and limitations remain.
Understanding these differences is essential for building apps on Webflow Cloud.
Node.js compatibility in Webflow Cloud
The Workers runtime is steadily expanding support for Node.js APIs, but there are still limitations.
- Native support: Many Node.js APIs are now natively supported, including modules like
Buffer
,crypto
,stream
, andpath
. See the Cloudflare Node.js compatibility matrix for the full list. - Polyfills: For unsupported APIs, Cloudflare provides polyfills. These partial implementations enable many packages to run, but unsupported methods may throw errors at runtime.
When you deploy to Webflow Cloud, Node.js compatibility settings are automatically applied to your Worker.
You can’t edit or override these settings when deploying to Webflow Cloud.
- Node.js compatibility and polyfills are enabled by default.
- You cannot add, remove, or customize polyfills or compatibility flags.
- Some npm packages that require unsupported Node.js APIs or extra configuration may not work as expected. If you encounter issues, use native Web APIs instead.
Common errors
If you use an unsupported Node.js API, you may see errors in your build logs:
- Module not found or import errors
Build log
- Runtime exceptions
Build log
- Silent failure or incomplete functionality
Build log
If you encounter these errors, switch to native Web APIs or supported APIs. For more details, see the Cloudflare Node.js compatibility matrix and the official Cloudflare Workers Node.js API docs.
Best practices for edge compatibility
Use Web APIs for network and data operations
Node.js APIs aren’t always supported in the edge runtime. When that’s the case, use the equivalent Web API — see below for a list of common Node.js APIs and their Web counterparts.
Choose edge-compatible libraries
Many popular libraries now rely on Web APIs instead of Node.js core modules. When possible, choose libraries built for edge environments or with pure JavaScript implementations.
To help, we’ve compiled a list of popular libraries and their edge-compatible alternatives.
Troubleshoot library compatibility
- Check for errors like
ReferenceError: process is not defined
orModule not found: fs
. These indicate Node.js dependencies that aren’t supported in the Workers runtime. - Polyfills using
unenv
or customwrangler.jsonc
aren’t currently supported on Webflow Cloud.