-
Notifications
You must be signed in to change notification settings - Fork 4.6k
bg-conic not working in next.js production builds #17977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Debugged the difference with +++ Next.js
--- @tailwindcss/cli
@property --tw-gradient-from-position {
syntax:"<length-percentage>";
inherits:false;
+ initial-value:0
- initial-value:0%
} It seems like some extra CSS minifier strips the percentage sign from the above You can workaround this by adding the class name |
I noticed this initially, and assumed 0 was an accepted value for |
Hey! This is happening because of a minifier used in Next.js. As a workaround, you could add this workaround to your const nextConfig = {
webpack(config) {
// Disable CSS minification
config.optimization.minimizer = config.optimization.minimizer.filter((fn: any) => {
return !fn.toString().includes("CssMinimizerPlugin");
});
return config;
},
}
module.exports = nextConfig Or use ESM / TypeScript, the important part is the webpack config to remove the CSS minifier. |
Are there any tickets tracking this issue that you know of, @RobinMalfait? |
@Multiply not yet, I have to create a minimal reproduction and open an issue, but wanted to give you a workaround in the meantime. |
Following some breadcrumbs, this might have fixed it? Edit: |
That might fix it, but I also think that Next.js is bundling the dependency instead of relying on it as an actual dependency. They also use |
Yes, that's where I got the above package from, as they include that in there. |
As a follow-up, I'm confident the PR I referenced earlier does not fix the underlying issue. It's only about I'd assume if we just add one more condition there, it'll be solved. Edit: I've added a PR to solve it here: cssnano/cssnano#1702 |
Opened an upstream issue with a reproduction: |
What version of Tailwind CSS are you using?
v4.1.6
What build tool (or framework if it abstracts the build tool) are you using?
Next.js 15.3.2
What version of Node.js are you using?
v22.11.0
What browser are you using?
Chrome
What operating system are you using?
macOS
Reproduction URL
https://github.com/Multiply/next.js-tailwind-conic-bug
(based on
npx create-next-app@latest
for the initial commit)Describe your issue
In next.js production builds (
npm run build
->npm run start
)bg-conic
'sbackground-image
does not work.It works fine in development builds
npm run dev
.My initial thoughts would be that it's a
@layer
issue, but I haven't played too much with it yet, to really debug it further.The text was updated successfully, but these errors were encountered: