Package Type Changes: ESM and CommonJS Support
mainThe SDK is now ESM-first with dual CJS/ESM exports. Most projects will not require changes because the SDK uses conditional exports to automatically select the correct build for your runtime or bundler.
- ESM: Use standard
importsyntax. - CommonJS: Use standard
requiresyntax. - Cloudflare Workers: Import from
@workos-inc/node/worker.
Warning on Deep Imports: Internal file structures have changed. You must stop using deep imports (e.g., importing from @workos-inc/node/lib/...) and instead use the public API surface.
// ESM - works
import { WorkOS } from '@workos-inc/node';
// CommonJS - still works
const { WorkOS } = require('@workos-inc/node');
// Cloudflare Workers - use /worker
import { WorkOS } from '@workos-inc/node/worker';