nx icon indicating copy to clipboard operation
nx copied to clipboard

Have SVGO features enabled when running SVGR webpack plugin

Open smithad15 opened this issue 2 years ago • 1 comments

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.

smithad15 avatar Mar 23 '22 23:03 smithad15

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.

skoob13 avatar Aug 05 '22 09:08 skoob13

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.

jbean96 avatar Nov 22 '22 19:11 jbean96

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! 🙏

github-actions[bot] avatar Jul 31 '23 00:07 github-actions[bot]

This is still an issue.

stephenwade avatar Jul 31 '23 15:07 stephenwade