Skip to content

useLightningcss

Source URL: https://nextjs.org/docs/app/api-reference/config/next-config-js/useLightningcss

This feature is currently experimental and subject to change, it is not recommended for production.

Experimental support for using Lightning CSS with webpack. Lightning CSS is a fast CSS transformer and minifier, written in Rust.

If this option is not set, Next.js on webpack uses PostCSS with postcss-preset-env by default.

Turbopack uses Lightning CSS by default since Next 14.2. This configuration option has no effect on Turbopack. Turbopack always uses Lightning CSS.

import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
experimental: {
useLightningcss: false, // default, ignored on Turbopack
},
}
export default nextConfig
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
useLightningcss: true, // disables PostCSS on webpack
},
}
module.exports = nextConfig
VersionChanges
15.1.0Support for useSwcCss was removed from Turbopack.
14.2.0Turbopack’s default CSS processor was changed from @swc/css to Lightning CSS. useLightningcss became ignored on Turbopack, and a legacy experimental.turbo.useSwcCss option was added.