CSS minification issue in an outdated Next.js version with unclear reproduction steps.
The issue involves CSS minification errors in Next.js v14.2.35, specifically affecting production builds. The problem is partially reproduced through nextra-theme-docs, but maintainers request a direct reproduction. The outdated version complicates potential fixes.
https://codesandbox.io/p/devbox/quirky-panna-2m23xd
This issue only persists in production builds (next build) and does not appear in development mode.
This project imports the nextra-theme-docs/style.css file in /app/layout.tsx. There are some styles in this style file (such as: .x:max-xl:hidden, .x:max-lg:block, etc.), but in the css file of the packaged file, the styles of these class names have changed.
Expected Behavior
Actual Behavior
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Available memory (MB): 4102
Available CPU cores: 2
Binaries:
Node: 20.12.0
npm: 10.5.0
Yarn: 1.22.19
pnpm: 8.15.6
Relevant Packages:
next: 14.2.35 // An outdated version detected (latest is 16.1.7), upgrade is highly recommended!
eslint-config-next: 15.5.7
react: 18.3.1
react-dom: 18.3.1
typescript: 5.8.3
Next.js Config:
output: export
CSS
next build (local)
Currently, I have resolved this issue by manually overriding the built-in CssMinimizerPlugin in next.config.js and replacing it with a fresh instance of css-minimizer-webpack-plugin.
<img width="846" height="270" alt="Image" src="https://github.com/user-attachments/assets/0807b7ae-0720-4085-9d
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!