web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
9.22k stars 537 forks source link

[Feature]: builtin-lightningcss-loader add support for `visitor` option #7608

Open ckken opened 4 weeks ago

ckken commented 4 weeks ago

What problem does this feature solve?

https://rspack.dev/zh/guide/features/builtin-lightningcss-loader#options https://lightningcss.dev/transforms.html

What does the proposed API of configuration look like?

LightningcssLoaderOptions 增加 visitor

JSerFeng commented 3 weeks ago

It's cool but not that high priority for us at present, and if using JavaScript visitor, there will be interop between Rust and JavaScript, so the performance gain of builtin-loader is gone, in this case you can try calling lightningcss-node binding yourself, or you can try this loader from community

We will support visitors in the future, but still, not high priority for us at present, of course we are happy to help if you are willing to contribute for this feature

ckken commented 2 weeks ago

Without visitor, from a business perspective, built-in functions are useless, such as px to vw, etc.

ckken commented 2 weeks ago

https://empjs.dev/plugin/tool/plugin-lightningcss.html At present, the processing method of postcss has been rewritten. I just want to switch to the built-in function, but the gap is a bit big