Skip loadBindings() Lightning CSS check during next start (#91538)
### What? Skip the `loadBindings()` call that checks Lightning CSS support when `loadConfig()` is called during `PHASE_PRODUCTION_SERVER` (`next start`). ### Why? `loadConfig()` currently calls `loadBindings()` (which loads the native SWC `.node` binary) whenever `experimental.useLightningcss: true` is set, in order to check whether the binary supports Lightning CSS. This check gates a warning and a flag reset. During `next start`, the app is already fully built — no CSS compilation happens at serve time. Loading the native binary purely to run a capability check that has no effect is wasted work, and it delays server startup unnecessarily. ### How? - Promote `PHASE_PRODUCTION_SERVER` from a type-only import to a value import in `config.ts` so it can be used in a runtime comparison. - Add `phase !== PHASE_PRODUCTION_SERVER &&` as the first condition of the `if` block that calls `loadBindings()` for the Lightning CSS check. When the phase is `PHASE_PRODUCTION_SERVER`, the block is skipped entirely and `useLightningcss` is left as-is (unchanged). All other phases (`PHASE_DEVELOPMENT_SERVER`, `PHASE_PRODUCTION_BUILD`, `PHASE_EXPORT`, etc.) are unaffected — `loadBindings()` is still called and the capability check runs as before. Co-authored-by:Tobias Koppers <sokra@users.noreply.github.com> Co-authored-by:
Claude <noreply@anthropic.com>
Showing
Please
register
or
sign in
to comment