mirror of
https://github.com/xtr-dev/payload-automation.git
synced 2025-12-10 08:53:23 +00:00
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:
26
src/exports/server.ts
Normal file
26
src/exports/server.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// Server-side only exports - should never be bundled for client
|
||||
// These contain Node.js dependencies and should only be used server-side
|
||||
|
||||
export { triggerCustomWorkflow, triggerWorkflowById } from '../core/trigger-custom-workflow.js'
|
||||
export { WorkflowExecutor } from '../core/workflow-executor.js'
|
||||
export { workflowsPlugin } from '../plugin/index.js'
|
||||
|
||||
// Export all step handlers (server-side only)
|
||||
export {
|
||||
createDocumentHandler,
|
||||
deleteDocumentHandler,
|
||||
httpStepHandler,
|
||||
readDocumentHandler,
|
||||
sendEmailHandler,
|
||||
updateDocumentHandler
|
||||
} from '../steps/index.js'
|
||||
|
||||
// Export step tasks configurations (server-side only)
|
||||
export {
|
||||
CreateDocumentStepTask,
|
||||
DeleteDocumentStepTask,
|
||||
HttpRequestStepTask,
|
||||
ReadDocumentStepTask,
|
||||
SendEmailStepTask,
|
||||
UpdateDocumentStepTask
|
||||
} from '../steps/index.js'
|
||||
Reference in New Issue
Block a user