Description
When using @workflow/world-postgres with Next.js 15, the app fails with an ES Module error when trying to start a workflow via workflow/api.
Error
Error: require() of ES Module @workflow/world-postgres/dist/index.js not supported.
Instead change the require() to a dynamic import() which is available in all CommonJS modules.
Environment
- Next.js: 15.5.9
- workflow: 4.0.1-beta.48
- @workflow/world-postgres: 4.1.0-beta.28
- Node.js: 20.x
Steps to Reproduce
- Create a Next.js 15 app with
withWorkflow in next.config.ts
- Install
workflow and @workflow/world-postgres
- Create an API route that imports from
workflow/api:
import { start } from "workflow/api";