ghostCamel
CDCloudflare Developers
•Created by Giraffe on 1/26/2025 in #workers-help
Bun install or Skip NPM install for Workers
I figured this out for my monorepo!
Reading the docs here: https://developers.cloudflare.com/workers/ci-cd/builds/build-image/#skip-dependency-install
Bun is a supported build runtime. Here's what I did:
1. Specifying the Bun Version:
Environment Variable: You can set the BUN_VERSION environment variable in your Cloudflare Workers project settings (Settings > Build > Build Variables and Secrets) to specify the Bun version you want to use. BUN_VERSION = 1.1.33.
2. Skipping Automatic Dependency Installation:
SKIP_DEPENDENCY_INSTALL=true
Variable: To prevent Cloudflare from automatically running npm install, set the SKIP_DEPENDENCY_INSTALL build variable to 1 or true. This allows you to take full control of the installation process.
3. Custom Install Command:
Once you've skipped the automatic dependency installation, you can use the build command to run bun install (or any other custom installation steps you need). Your build command might look like this:
bun install
Deploy Command:
bun wrangler deploy
Path:
/packages/backend
8 replies