Webpack assets are broken. No, just kidding, they just dont work how you expect them to. I probably need to file a bug report for this one..
Problem
Assets were not building, but the compiling would say otherwise. I thought my assets were good as gold.
From the gitlab-ci output:
Compiling...
Compiled all packs in /app/public/packs
Unfortunately, the assets were done for. When we deployed to production, the css was broken and the JS didn’t even load.
It was even better the fact that the app wa running at a subdirectory which was all new to me. There were many problems with the scenario, but the good news was that “it was working on my local machine.”
app/bin/webpack vs rails webpack:compile
I would have never guessed there’s a difference between /app/bin/webpack
and bundle exec rails webpacker:compile
, but let me tell you there is and it’s a big one.
Assets compile incorrectly with the rails reccommended way bundle exec rails webpacker:compile
so I had to go off script and compile them with the javascript way /app/bin/webpack
.
This was great because now I have webpack managing javascript which is a complete fucking nightmare. Things are constantly breaking within the javascript world, which is just great for compatability.
Fixed
The good news is that the issue is fixed. I am trying the best to keep rails rails, and the javascript the javascript. I think in this instance, rails was trying to manage the javascript packages and javascript didn’t like it.