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-dev
to start Temporal Server.npm install
to install dependencies.npm run start.watch
to start the Worker.- In another shell,
npm run workflow
to run the Workflow.
The Workflow should return:
Hello, Temporal!
npm run build
to build the Worker script and Activities code.npm run build:workflow
to build the Workflow code bundle.NODE_ENV=production node lib/worker.js
to run the production Worker.