Replies: 2 comments 3 replies
-
|
Throw this into your package.json "browserslist": [
"chrome >= 123",
"edge >= 123",
"firefox >= 120",
"safari >= 17.5"
]Turbopack via LightningCSS, is trying to cover older browsers that don't support these, aka modifications that ensure the app is functional in browsers that don't support the new CSS color functions (baseline 2024). |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Hello there You can disable LightningCSS in your /** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
lightningcss: false,
},
}
module.exports = nextConfig
Alternatively, if you want to keep minification but skip transformations, try:
const nextConfig = {
experimental: {
lightningcss: {
minify: true,
targets: {}, // disables browser compatibility transforms
},
},
}
module.exports = nextConfig
After editing your config, clear the cache:
rm -rf .next
npm run dev
This stopped Next.js from modifying light-dark() and other CSS color functions for me. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have not told Next.js to transform anything. I'm using CSS modules because I assumed they are closest to vanilla CSS, and what do I get? Transformation I never asked for.
I'm using the
light-dark()function (see below), and Next.js transforms it into some messy variables malarky. Sorry if I'm sounding a bit grumpy, but why is this being done please? I'm writing it the way I want, because that's what how I want things. Not so that some process that is documented exactly nowhere, can go ahead and mess up what I took the time to write carefully and properly. It's a teensy weensy bit disrespectful, frankly, to be doing CSS tranformation without the dev's consent or permission.Anyway, that's the rant done. The question is:
How do I configure PostCSS, or LightningCSS, or whatever is responsible, to stop touching my CSS files please? Minification is fine. Just no functional modifications of any kind please.
I'm on Next.js 16, Turbopack, app router.
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions