Using webpacker in Rails Engines?
I'm making a pluggable CMS engine and want to keep the JS/CSS (preferably by writing Tailwind components) in the engine. It works great with models, controllers, routes and the asset pipeline, but I really can't figure out the best way to do it with Webpacker-packs.
It would be super cool if Chris could cover this. Nobody in that github issue thread has found an official answer to this, and the official README from the rails/webpacker repository just doesn't work as intended. At least not for me.
This is something I've been struggling with for a long time, and apparently so has a lot of other people. There are unanswered StackOverflow posts, unanswered reddit posts, and of course, that entire issue ticket which has ideas but no solutions. There are a few solutions, but they're hacky, and don't work for everyone
Even if the only good solution right now is hacky, that's probably enough for most peoples' needs until someone creates a good solution. I'd love to contribute, but I don't have enough rails and/or webpacker knowledge yet to do so.
This thread started on GoRails started about a year and half ago, and there still isn't a clear answer anywhere. There wasn't a clear answer in rails 5, and there still isn't an answer in rails 6, even with the now released stable version.
Again, it seems that way. If there is some article on the internet some where that explains how to have a rails 6 engine with webpacker that can either server compiled assets to the parent app, or let the parent app be responsible for compiling its own assets as well as all the engines assets to which it's connected, please point me to it.