An example of building your Workflow code bundle at build time and giving that prebuilt bundle to the Worker (in order to reduce Worker startup time).
- Worker code:
src/worker.ts - Workflow build script:
src/scripts/build-workflow-bundle.ts
For more production topics, see our Production & Deployment docs page.
temporal server start-devto start Temporal Server.npm installto install dependencies.npm run start.watchto start the Worker.- In another shell,
npm run workflowto run the Workflow.
The Workflow should return:
Hello, Temporal!
npm run buildto build the Worker script and Activities code.npm run build:workflowto build the Workflow code bundle.NODE_ENV=production node lib/worker.jsto run the production Worker.