ant-design / static-style-extract

MIT License
23 stars 5 forks source link

empty antd.min.css #3

Open kolpaja opened 1 year ago

kolpaja commented 1 year ago

when runing predev script to load the styles of antd.min.css empty

I am using nextjs with the help of the function import fs from 'fs'; import { extractStyle } from '@ant-design/static-style-extract'; // import { ConfigProvider } from "antd"; // import React from "react";

const outputPath = './public/antd.min.css';

const css = extractStyle();

console.log(css.length);

fs.writeFileSync(outputPath, css);

console.log(🎉 Antd CSS generated at ${outputPath});

and the CSS is not generated

iliapir2 commented 1 year ago

I have exactly the same issue

mehdiraized commented 1 year ago

I have exactly the same issue.

kiner-tang commented 1 year ago

It run as expected for me! @kolpaja You can clone the following repo and run again!

image
iliapir2 commented 1 year ago

@kiner-tang for some reason, when I copied package source to my project it works as expected, but when I try to run in from node_modules as suggested in documentation it produces empty css file.

kiner-tang commented 1 year ago

@iliapir2 Can you provide a online reproduction or provide a minimal GitHub repository?

kolpaja commented 1 year ago

@kiner-tang i manualy added a version of ant.min.css and I don't see any improvements in my nextjs application, I will try to a simple demo projected later on and I will inform

Arno500 commented 1 year ago

It is because of the @ant-design/cssinjs library. When upgrading to 1.4.x and more, the CSS output is entirely empty. When forcing the resolution to 1.3.x, everything is back to normal. I also observed that the generated cache was empty, so the problem probably lies in cssinjs, not in static-style-extract