-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Verify canary release
- I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
https://github.com/lfantone/turborepo-gen-bun-compat-repro
Which canary version will you have in your reproduction?
turbo 2.8.12-canary.2
Environment information
CLI:
Version: 2.8.12-canary.2
Path to executable: /Users/lfantone/Workspace/sas/adg-octopus-main/node_modules/turbo-darwin-arm64/bin/turbo
Daemon status: Not running
Package manager: berry
Platform:
Architecture: aarch64
Operating system: macos
WSL: false
Available memory (MB): 6392
Available CPU cores: 12
Environment:
CI: None
Terminal (TERM): xterm-256color
Terminal program (TERM_PROGRAM): zed
Terminal program version (TERM_PROGRAM_VERSION): 0.226.1+preview.185.548dbdcb52a7e1b0d6969225e7f475b4fa965aef
Shell (SHELL): /bin/zsh
stdin: false
Expected behavior
Generator configs using standard Node.js APIs (e.g., findPackageJSON from node:module) should continue to work across patch releases of @turbo/gen, since patch versions must not introduce breaking changes per semver.
Actual behavior
Starting in 2.8.8, @turbo/gen switched its runtime from Node.js to an embedded Bun v1.3.9 binary (PR #11825, commit 4f5632c). This was released as a patch bump (2.8.7 → 2.8.8), but Bun does not fully implement the Node.js API surface.
Generator configs that worked under 2.8.7 now fail with errors like:
TypeError: import_node_module.findPackageJSON is not a function
module.findPackageJSON is a stable Node.js API (available since v22.8.0), but Bun has not implemented it — there's an open bug for it: oven-sh/bun#23898.
This is not limited to findPackageJSON. Any Node.js API that Bun hasn't implemented will break in the same way, making this a potentially wide-reaching issue for existing generator configs.
To Reproduce
- Create a turbo generator config that uses
findPackageJSONfromnode:module:
// turbo/generators/config.js
import { findPackageJSON } from 'node:module';
const pkgPath = findPackageJSON('some-package', import.meta.url);
export default function generator(plop) {
// ...
}- With
turbo@2.8.7:turbo genworks fine (runs under Node.js) - Upgrade to
turbo@2.8.8or later:turbo genfails with `TypeError: import_node_module.findPackageJSON is not a function
Additional context
The commit message for the Bun migration uses the feat: conventional commit prefix, but it was released as a patch version (2.8.7 → 2.8.8). A runtime swap that changes API compatibility should arguably be at least a minor bump, if not a major one, since it silently breaks existing generator configs.
- Verified the issue still exists in canary (
2.8.12-canary.2) — the Bun binary approach is unchanged. - This is particularly subtle because
findPackageJSONappears in Bun's own documentation as if it's supported, but the implementation doesn't exist in any released version.