0👍
✅
I had a similar issue and mainly was due to webpack version.
I had webpack version 4.1.1 and my configuration was working with the 3.11
You can check your version with webpack --version
After that re-run a bundle exec rails webpacker:install
and yarn install
It worked for me
Source:stackexchange.com