refactor: Vendor lightningcss-napi as turbopack-lightningcss-napi#92013
refactor: Vendor lightningcss-napi as turbopack-lightningcss-napi#92013
Conversation
Replace the external lightningcss-napi dependency with a vendored copy at turbopack/crates/turbopack-lightningcss-napi. Source files are copied verbatim from the upstream lightningcss repository, include the upstream LICENSE, and are formatted with cargo fmt. Bump lightningcss from 1.0.0-alpha.70 to 1.0.0-alpha.71 to match the vendored napi crate.
Make the vendored turbopack-lightningcss-napi crate only include the visitor functionality Next.js uses. Remove the unused bundler feature, its extra dependencies, and the dead code paths that supported it.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Failing test suitesCommit: 677821a | About building and testing Next.js
Expand output● Empty Project › Should not time out and return 404
Expand output● Telemetry CLI › production mode › cli session: babel tooling config ● Telemetry CLI › production mode › cli session: custom babel config (plugin) ● Telemetry CLI › production mode › cli session: package.json custom babel config (plugin) ● Telemetry CLI › production mode › cli session: custom babel config (preset) ● Telemetry CLI › production mode › cli session: next config with webpack ● Telemetry CLI › production mode › detect static 404 correctly for ● Telemetry CLI › production mode › detect page counts correctly for |
Merging this PR will degrade performance by 3.01%
Performance Changes
Comparing Footnotes
|
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |

We want to migrate to napi v3. However, lightningcss uses napi v2. It might make sense for us to upstream support for napi v3 to lightningcss, but that's a major breaking change for lightningcss to make, and it's not very practical for it to support both napi v2 and napi v3.
So instead, let's vendor it for now: