-
-
Notifications
You must be signed in to change notification settings - Fork 100
Description
I've got a project with a rails engine mounted in it, and we're working through upgrading from an older version of Webpacker to Shakapacker. The setup for the rails engine is pretty similar to the instructions found here, with one addition: we also enhanced the assets:precompile
task to run the task in our engine when it is being run from the main rails directory.
Rake::Task['assets:precompile'].enhance do
Rake::Task['my_engine:webpacker:yarn_install'].invoke
Rake::Task['my_engine:webpacker:compile'].invoke
end
I've been trying to modify it to work with shakapacker, but I'm running into issues. The assets:precompile
task no longer adds the packs to the public
folder for our rails engine, so the tests in our CI process are breaking. Is there a better guide available on how to set up shakapacker for a mounted/nested rails engine? Or can anyone help me troubleshoot and figure out what I'm doing wrong? Is the better option to install the shakapacker gem in both the main app as well as the rails engine and run rails shakapacker:install
from the engine? I've got the shakapacker js library installed along with its dependencies, and I'm using
@webpacker ||= ::Shakapacker::Instance.new(
root_path: ROOT_PATH,
config_path: ROOT_PATH.join("config/webpacker.yml")
)
instead of using the Webpacker
instance from the guide. I can provide other config files as well if they will help, I just didn't want to make this issue extremely long.