From b27e53415fd616fd9f8acff7f735de4b86d61639 Mon Sep 17 00:00:00 2001 From: Wawa Date: Sun, 10 May 2026 00:02:37 +0000 Subject: [PATCH] Hoist platform-specific native packages via root optionalDependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Real root cause: Tailwind v4's lightningcss is invoked from a Turbopack-bundled postcss.js at runtime. Turbopack resolves require() against the workspace's TOP-LEVEL node_modules, not against bun's nested .bun/ store. So even when lightningcss-darwin-arm64 is correctly installed inside .bun/ with proper symlinks, Turbopack can't see it — and lightningcss falls back to a sibling '.node' file which doesn't exist, hence the runtime error. Private-editor accidentally works because it has TWO lightningcss versions (1.27.0 from Expo + 1.32.0 from Tailwind), which forces bun's hoisting algorithm to put one copy at the top level. Editor-v2 has only one version, so bun keeps it nested in .bun/ and nothing is at top-level. Fix: declare the platform binary packages as optionalDependencies at the WORKSPACE ROOT (not apps/editor). Root deps are always hoisted to top-level node_modules, so Turbopack's resolver finds them. Bun still applies the os/cpu filter at install time, so each developer only ends up with their host's binaries on disk. Verified on Linux: node_modules/lightningcss-linux-arm64-gnu is a top-level symlink after install. On macOS, the darwin variants will be hoisted instead. --- bun.lock | 10 ++++++++++ package.json | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/bun.lock b/bun.lock index 9c8dcbab..1f535e0c 100644 --- a/bun.lock +++ b/bun.lock @@ -11,6 +11,16 @@ "typescript": "6.0.2", "ultracite": "^7.2.5", }, + "optionalDependencies": { + "@tailwindcss/oxide-darwin-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-x64": "4.3.0", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + }, }, "apps/editor": { "name": "editor", diff --git a/package.json b/package.json index 2565710e..bb9acd33 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,16 @@ "@types/react-dom": "19.2.3", "@types/three": "0.184.0" }, + "optionalDependencies": { + "@tailwindcss/oxide-darwin-arm64": "4.3.0", + "@tailwindcss/oxide-darwin-x64": "4.3.0", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.0", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0" + }, "workspaces": [ "apps/*", "packages/*",