Whenever I try pushing my Rails 6 app to Heroku, I kept getting an error message "Precompiling assets failed". I notice from the traceback that it was complaining of "Field 'browser' doesn't contain a valid alias configuration" for the "@fortawesome/fontawesome-free/js/all" import.
Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_7682b1717ca625690f7939609cc5a51d/app/javascript/@fortawesome/fontawesome-free/js/all doesn't exist
remote: .jsx
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_7682b1717ca625690f7939609cc5a51d/app/javascript/@fortawesome/fontawesome-free/js/all.jsx doesn't exist
remote: .mjs
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_7682b1717ca625690f7939609cc5a51d/app/javascript/@fortawesome/fontawesome-free/js/all.mjs doesn't exist
remote: .js
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_7682b1717ca625690f7939609cc5a51d/app/javascript/@fortawesome/fontawesome-free/js/all.js doesn't exist
remote: .sass
remote: Field 'browser' doesn't contain a valid alias configuration
remote: /tmp/build_7682b1717ca625690f7939609cc5a51d/app/javascript/@fortawesome/fontawesome-free/js/all.sass doesn't exist
remote: .scss
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
Following some suggestions I tried to modify the FontAwesome import in my project from import "@fortawesome/fontawesome-free/js/all" to ```import "./fortawesome/fontawesome-free/js/all" but this did not work for me.