dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
https://craco.js.org
Apache License 2.0
7.43k stars 499 forks source link

[postcss] Config postcss-pxtorem dosen't work #505

Closed kivenli closed 1 year ago

kivenli commented 1 year ago

What's happening I want to add a postcss plugin named "postcss-pxtorem“ in config file to convert px unit to rem, but it donsen't work What should happen Should make the px unit convert to rem.

To reproduce Config list below: const CracoLessPlugin = require("craco-less"); module.exports = { plugins: [{ plugin: CracoLessPlugin }], style: { postcss: { mode: "extends", loaderOptions: { postcssOptions: { ident: "postcss", plugins: [ [ "postcss-pxtorem", { rootValue: 375 / 10, }, ], ], }, }, }, }, };

and I also test other config: module.exports = { plugins: [{ plugin: CracoLessPlugin }], style: { postcss: { mode: "extends", plugins: [ require("postcss-pxtorem")({ rootValue: 375 / 10, propList: ["*"], }), ], }, }, };

Also dosen't work, I can confirm the CracoLessPlugin works, but i realy dont' know why the postcss-pxtorem dosen't work,

CRACO version "@craco/craco": "^7.0.0", "postcss": "^8.4.22", "postcss-pxtorem": "^5.1.1",

Additional information (anything else that could be useful for us to help you solve your problem)

lvchenyang commented 1 year ago

Postcss plugin not working too!

vlad-elagin commented 1 year ago

@lvchenyang I've provided possible workaround here #506