Fix client-side bundling by separating server and client exports

- Create dedicated /server export for server-side functions and plugin
- Main export now contains only types (client-safe)
- Remove problematic /steps export that exposed server functions
- Update README with correct import structure
- Fix tests to use /server export

This prevents server-side code from being bundled in client JavaScript,
eliminating the "require is not defined in ES module scope" runtime error.

Breaking change: workflowsPlugin must now be imported from '/server':
import { workflowsPlugin } from '@xtr-dev/payload-automation/server'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-08-31 18:06:39 +02:00
parent 19b9566df6
commit cadb40e401
6 changed files with 86 additions and 22 deletions

View File

@@ -30,10 +30,10 @@
"types": "./dist/exports/views.d.ts",
"default": "./dist/exports/views.js"
},
"./steps": {
"import": "./dist/steps/index.js",
"types": "./dist/steps/index.d.ts",
"default": "./dist/steps/index.js"
"./server": {
"import": "./dist/exports/server.js",
"types": "./dist/exports/server.d.ts",
"default": "./dist/exports/server.js"
}
},
"main": "dist/index.js",