Skip to content

Instantly share code, notes, and snippets.

@parties
Last active April 27, 2024 19:37
Show Gist options
  • Star 68 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save parties/90cdf35f9a3d05bea6df76dc83a69641 to your computer and use it in GitHub Desktop.
Save parties/90cdf35f9a3d05bea6df76dc83a69641 to your computer and use it in GitHub Desktop.
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@Dev-Zhao
Copy link

Dev-Zhao commented Mar 27, 2024

@inrl-md All this gist does is change .js files containing jsx code to have the .jsx extension. If you need help with polyfill for webpack 5, you can post a question on stackoverflow or open an issue in the webpack repo. No one will know why your webpack is not working when you have not provided any information. I suggest setting up your react project in a https://codesandbox.io/ and try to reproduce the error, so someone can help debug it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment