The `removeSvgLoaderIfPresent` method in `apply-react-config.ts` iterates through each Webpack rule, calls `toString` on each `test` property, and checks for the presence of the string `"svg"` to see if any existing SVG plugins need to be removed. Some of the Webpack rules in the config don't have the test property, and calling `toString` without asserting the test property is defined first throws type errors. This commit introduces a very small change that simply asserts that `rule.test` is not `undefined` before calling `.toString()`. ## Current Behavior Running a React Webpack library with `svgr` enabled causes compilation errors. <img width="1171" alt="Screenshot 2024-08-20 at 10 36 09 AM" src="https://github.com/user-attachments/assets/cb28d1ca-10d2-4d20-aa78-e69339a8273b"> <img width="487" alt="Screenshot 2024-08-20 at 10 39 28 AM" src="https://github.com/user-attachments/assets/c170e0d8-8674-43b0-97a3-a5dffd398c17"> ## Expected Behavior Enabling SVGR in the `NxReactWebpackPlugin` config should compile as normal. --------- Co-authored-by: Colum Ferry <cferry09@gmail.com>