-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Labels
Description
What version of Bun is running?
1.3.4+5eb2145b3
What platform is your computer?
Darwin 25.1.0 arm64 arm
What steps can reproduce the bug?
- Create a monorepo with workspaces defined in
package.json - Create a workspace package as a symlink to a directory outside the monorepo
- Run
bun install
# Create a monorepo structure
mkdir my-monorepo
cd my-monorepo
# Create root package.json with workspaces
cat > package.json << 'EOF'
{
"name": "my-monorepo",
"version": "1.0.0",
"workspaces": ["./*"],
"dependencies": {
"backend": "workspace:*"
}
}
EOF
# Create a workspace package outside the monorepo
mkdir -p /tmp/backend-package
cat > /tmp/backend-package/package.json << 'EOF'
{
"name": "backend",
"version": "1.0.0"
}
EOF
# Create a symlink to the external workspace
ln -s /tmp/backend-package backend
# Try to install
bun installWhat is the expected behavior?
Bun should follow symlinks when scanning for workspace packages and successfully resolve the backend workspace dependency. The installation should complete without errors, similar to how npm, yarn, and pnpm handle symlinked workspaces.
What do you see instead?
error: Workspace dependency "backend" not found
Searched in "./*"
Workspace documentation: https://bun.com/docs/install/workspaces
error: backend@workspace:* failed to resolve
Bun fails to recognize the symlinked directory as a valid workspace package because the workspace scanning code doesn't follow symlinks by default.
Additional information
The GlobWalker used for scanning workspace patterns in src/install/lockfile/Package/WorkspaceMap.zig:230 is initialized with follow_symlinks: false, which prevents it from descending into symlinked directories.
This is a common pattern in monorepos where:
- Workspace packages are stored in separate repositories
- Packages are shared across multiple monorepos
- Local development uses symlinks to external packages