nx
nx copied to clipboard
Have SVGO features enabled when running SVGR webpack plugin
Description
When importing SVGs as React components, the SVGR Webpack plugin is working fine and able to be configured through a standalone svgr.config.js
file (or similar) as supported by the underlying tool. The issue however is that any options related to SVGO functionality do not work. It seems as if the SVGO step in the pipeline has been permanently disabled based on the React webpack config. Would it be possible to re-enable SVGO in the SVGR pipeline so that imported SVG components can be optimized however the end user wishes (either based on the plugin defaults or overridden through a separate config file)? I'm not sure why this would be disabled in the first place.
Motivation
Since SVGR is included in the build tooling, it would be most beneficial to be able to utilize all of its functionality as opposed to disabling a significant portion of its feature set.
Suggested Implementation
Remove the svgo: false
config line in the React webpack config. End users would then be able to configure its operation (or disable it completely) through an external config file.
The same applies to the Next.js configuration. Is there any reason why svgo: false
should be applied? There are a lot of SVG assets in our organization, so we had to patch the React and Next.js packages to enable svgo.
Any thoughts or work on this? Would also like to configure some SVGO functionality, would seem pretty feasible to allow the configuration of SVGR in next.config
instead of just true
/false
.
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This is still an issue.