From e130e5d53306c5117535ef250ddc4a7156b2f24d Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Tue, 7 Apr 2026 23:17:47 -0700 Subject: [PATCH] fix: workflow/next ESM compatibility for .mjs config files Use named export instead of `export =` in the CJS shim so that Node.js cjs-module-lexer can detect withWorkflow as a named export, enabling `import { withWorkflow } from 'workflow/next'` in ESM. --- .changeset/fix-next-esm-compat.md | 5 +++++ packages/workflow/src/next.cts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/fix-next-esm-compat.md diff --git a/.changeset/fix-next-esm-compat.md b/.changeset/fix-next-esm-compat.md new file mode 100644 index 0000000000..47c424643b --- /dev/null +++ b/.changeset/fix-next-esm-compat.md @@ -0,0 +1,5 @@ +--- +"workflow": patch +--- + +Fix `workflow/next` ESM compatibility for `next.config.mjs` files diff --git a/packages/workflow/src/next.cts b/packages/workflow/src/next.cts index e7ccd7a361..6923a6f2eb 100644 --- a/packages/workflow/src/next.cts +++ b/packages/workflow/src/next.cts @@ -1,4 +1,4 @@ // The Next.js plugin needs to support CommonJS usage since // `next.config.js` using CommonJS syntax is still common. import nextPlugin = require('@workflow/next'); -export = nextPlugin; +export const withWorkflow = nextPlugin.withWorkflow;