-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-scripts package: Resolving vulnerabilities by updating dependencies #13778
base: main
Are you sure you want to change the base?
Conversation
… fork properly on another project
…just for react-scripts alone
…iding the webpack setup for building react components out of svg
Hi @HiickFG! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
Well done @HiickFG! |
This Pull Request updates the following dependencies from react-scripts to the latest available version while also resolving a bug with .svg loading noticed during direct testing.
This clears high risk and moderate risk vulnerability warnings present when using react-scripts package as detailed below.
@svgr/webpack: ^8.1.0 (from ^5.5.0)
Resolves high vulnerability from outdated nth-check package dependency.
@svgr/webpack appears to be only used on the loading of svg files for react-scripts.
Changing the main version drastically didn't seem to require a change in the syntax for the relevant .svg loading rules. However, I did notice a bug in the process of checking if it would load an SVG icon properly depending on the approach used (as static media through <img> or as a React component through a .js file).
The bug:
When attempting to load an .svg file as a React component, the app was throwing the following error at Run Time:
" Failed to execute 'createElement' on 'Document': The tag name provided ('/static/media/MyUniverse192.d26f326c17598c3c29c571bb371b06c8.svg') is not a valid name. "
Which indicated that it was trying to interpret the svg file without transforming it into a React component as it was not being imported into the webpack @svgr/webpack loader.
The fix:
Further separating the rules into each use case resolved the problem. This enabled better specification of the issuer loading the content: Loading through Javascript/Typescript files would use the webpack loader, whereas the other scenarios would use the normal file-loader instead, treating the SVG as a static media.
resolve-url-loader: ^5.0.0 (from ^4.0.0)
Resolves moderate vulnerability from outdated postcss package dependency.
No apparent impact in the current react-scripts usage within webpack.config.js file.