Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Webpacker #101

Open
natemacinnes-okta opened this issue Apr 12, 2021 · 11 comments
Open

Support for Webpacker #101

natemacinnes-okta opened this issue Apr 12, 2021 · 11 comments

Comments

@natemacinnes-okta
Copy link

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>'
...
@natemacinnes-okta
Copy link
Author

<%= stylesheet_link_tag :exception_handler %>

<%= favicon_link_tag "exception_handler/favicon.ico" %>

<style>body { background: url("<%= asset_path x %>") center center no-repeat !important; background-size: cover !important; }</style>

config.assets.precompile << "exception_handler.css"

@natemacinnes-okta
Copy link
Author

natemacinnes-okta commented Apr 12, 2021

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...

@richpeck
Copy link
Owner

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

@natemacinnes-okta
Copy link
Author

natemacinnes-okta commented Apr 12, 2021 via email

@richpeck
Copy link
Owner

richpeck commented Apr 12, 2021 via email

@yrashk
Copy link
Contributor

yrashk commented Jul 29, 2021

@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.

@richpeck
Copy link
Owner

richpeck commented Jul 29, 2021 via email

@richpeck
Copy link
Owner

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).

@estebanz01
Copy link

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

@phortx
Copy link

phortx commented Jun 26, 2022

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 ...`

@ikonomov17
Copy link

ikonomov17 commented May 10, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants