Support for Webpacker
natemacinnes-okta opened this issue · 11 comments
Request to add support for Webpacker in place of Asset Pipeline.
NoMethodError: undefined method `assets' for #<Rails::Engine::Configuration:0x00007f83d48bb398>
/Users/natemacinnes/.rvm/gems/ruby-2.7.2/gems/railties-6.0.3.6/lib/rails/railtie/configuration.rb:96:in `method_missing'
/Users/natemacinnes/.rvm/gems/ruby-2.7.2/gems/exception_handler-0.8.0.1/lib/exception_handler/engine.rb:35:in `<class:Engine>'
/Users/natemacinnes/.rvm/gems/ruby-2.7.2/gems/exception_handler-0.8.0.1/lib/exception_handler/engine.rb:15:in `<module:ExceptionHandler>'
...
One option could be to add config option to copy the assets to packs/
instead of /assets
. Use the same option to use asset_pack_path
instead of asset_path
and not precompile.
Might be some other steps required too...
Hi Nathan, many thanks for the messages & comprehensive information!
I will need to double check this as the system was working fine up until the latest Rails release, so perhaps the assets methods have been phased out completely? I'll check in a bit for you.
Rich
@richpeck it would have been great to have it running in webpacker-only mode. The application I am working on also doesn't use sprockets assets pipeline.
I looked at the eval problem and you were correct -- I don't know why I used eval when send was sufficient.
I have been looking at webpack integration.
Unfortunately, it looks like getting webpacker to work with engines is not cut and dry. I'm trying to figure out how to make the two work side by side (IE if you don't have sprockets, how to get the CSS to compile with webpack).
I'm hitting this error as well when trying to move away from sprockets to propshaft. Rails admin gem, for rails 7 support, move it's current approach and implemented an install task that detects webpack(er) config and attaches the needed configs to it, in case you want to look at some examples
Hi, is there a workaround for that issue? I've added the gem to a Rails 6.1.6 project with webpacker it getting a undefined method
assets' for ...`
In our project I removed a gem, which had sprockets-rails
as a dependency and suddenly the app failed to start with the same NoMethodError: undefined method 'assets' ....
error. After reintroducing explicitly the sprockets-rails
gem it all works again. Is there a reason not to have sprockets-rails
specified as a dependency?