Skip to content
vxvx
GitHubBlueskydev.toRSS

node_modules for stateless workers

Run the install as a remote action, so every worker has node_modules without a shared disk.

An install task run as a remote action.

Remote workers start empty. Mark the install task remote: 'only' and it runs as a remote action whose output is node_modules.

Every task that depends on it gets that tree as an input, cached by the lockfile.

// config

// packages/api/vx.config.ts
import { defineProject } from '@vzn/vx/config'

export default defineProject({
  tasks: {
    install: {
      exec: { command: 'pnpm install --frozen-lockfile', remote: 'only' },
      cache: {
        inputs: { files: ['package.json', 'pnpm-lock.yaml'] },
        outputs: { files: ['node_modules/**'] },
      },
    },
  },
})
Turborepo, Nx and other product names are trademarks of their owners. vx is not affiliated with or endorsed by them.