Files
vercel__workflow/.changeset/lazy-discovery-bare-specifiers.md
Nathan Rajlich 32a17b4033 fix(next): resolve bare specifiers in copied step files for lazy discovery (#1670)
* fix(next): resolve bare specifiers in copied step files for lazy discovery

When the deferred builder copies step files to __workflow_step_files__/,
bare specifiers that are transitive SDK deps can't resolve from the app
directory. Use enhanced-resolve with ESM conditions (preferring 'import'
over 'require') to resolve from the original source location, only when
the specifier can't be resolved from the app directory.

Also add enhanced-resolve to the pnpm catalog and use catalog: in both
@workflow/builders and @workflow/next.

* fix(next): address review feedback on lazy discovery resolver

- Cache ESM/CJS resolvers as class fields instead of re-creating per call
- Remove redundant try/catch (resolveBareCopiedStepSpecifier already
  returns undefined on failure)
- Use shared NODE_RESOLVE_OPTIONS / NODE_ESM_RESOLVE_OPTIONS matching
  the configuration in swc-esbuild-plugin.ts for consistent resolution
2026-04-09 19:20:07 +00:00

408 B

@workflow/next, @workflow/builders
@workflow/next @workflow/builders
patch patch

Fix lazy discovery bare specifier resolution in copied step files

  • Use enhanced-resolve with ESM conditions to resolve bare specifiers from the original source file's location
  • Only rewrite specifiers that can't resolve from the app directory (transitive SDK deps)
  • Add enhanced-resolve to pnpm catalog and use catalog: in both packages