What is the best way to use webpacker in a Rails engine? : <p>I realise there is some debate about using webpacker in Rails engines but I have a simple usecase and currently have a workaround.  Would like to know of a better (the best?) solution.</p>

<p>In this rails engine I have webpacker setup in the "spec/dummy" directory and everything works well in dev:
<a href="https://github.com/RealEstateWebTools/property_web_scraper/tree/master/spec/dummy/config/webpack" rel="noreferrer">https://github.com/RealEstateWebTools/property_web_scraper/tree/master/spec/dummy/config/webpack</a></p>

<p>When the engine is used by a rails app however it will not find the compiled webpack files so each time I have a release ready I compile the webpack files and manually copy them to the vendor directory:
<a href="https://github.com/RealEstateWebTools/property_web_scraper/tree/master/vendor/assets/javascripts" rel="noreferrer">https://github.com/RealEstateWebTools/property_web_scraper/tree/master/vendor/assets/javascripts</a></p>

<p>I then require that file here:
<a href="https://github.com/RealEstateWebTools/property_web_scraper/blob/master/app/assets/javascripts/property_web_scraper/spp_vuetify.js" rel="noreferrer">https://github.com/RealEstateWebTools/property_web_scraper/blob/master/app/assets/javascripts/property_web_scraper/spp_vuetify.js</a></p>

<p>In my layout I use the above file using the good old sprockets "javascript_include_tag": <a href="https://github.com/RealEstateWebTools/property_web_scraper/blob/master/app/views/layouts/property_web_scraper/spp_vuetify.html.erb" rel="noreferrer">https://github.com/RealEstateWebTools/property_web_scraper/blob/master/app/views/layouts/property_web_scraper/spp_vuetify.html.erb</a></p>

<p>In the layout there is a check to see if I'm running the "spec/dummy" app in which case I will user webpacker as it would normally be used in dev.</p>

<p>There must be a better way than this.</p>
