exception_handler icon indicating copy to clipboard operation
exception_handler copied to clipboard

Support for Webpacker

Open natemacinnes-okta opened this issue 4 years ago • 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>'
...

natemacinnes-okta avatar Apr 12 '21 13:04 natemacinnes-okta

https://github.com/richpeck/exception_handler/blob/e0e1e427fd2ac9226fec1c932dc20ac71d10066b/app/views/layouts/exception.html.erb#L9 https://github.com/richpeck/exception_handler/blob/e0e1e427fd2ac9226fec1c932dc20ac71d10066b/app/views/layouts/exception.html.erb#L10 https://github.com/richpeck/exception_handler/blob/e0e1e427fd2ac9226fec1c932dc20ac71d10066b/app/views/layouts/exception.html.erb#L13 https://github.com/richpeck/exception_handler/blob/e0e1e427fd2ac9226fec1c932dc20ac71d10066b/lib/exception_handler/engine.rb#L35

natemacinnes-okta avatar Apr 12 '21 14:04 natemacinnes-okta

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

natemacinnes-okta avatar Apr 12 '21 14:04 natemacinnes-okta

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 avatar Apr 12 '21 15:04 richpeck

Oh, the asset pipeline hasn’t been completely phased out. To be clear, keeping the asset pipeline still works fine. In my case, the exception_handler gem is the only thing in my project that leverages the asset pipeline so was hoping to be able to configure it so that I could remove the sprockets dependency.

natemacinnes-okta avatar Apr 12 '21 15:04 natemacinnes-okta

Understandable.

Maybe I could add a configuration option for webpacker only?

Rich

On 12/04/2021 16:46 Nathan MacInnes ***@***.***> wrote:




Oh, the asset pipeline hasn’t been completely phased out. To be clear,
keeping the asset pipeline still works fine.
In my case, the exception_handler gem is the only thing in my project that
leverages the asset pipeline so was hoping to be able to configure it so
that I could remove the sprockets dependency.

On Mon, Apr 12, 2021 at 11:26 Richard Peck ***@***.***> wrote:

> *This message originated outside your organization.*
>
> ------------------------------
>
> 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
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/richpeck/exception_handler/issues/101#issuecomment-817904960>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AJQ4YDDGNHQDPQCGPLD5ABTTIMGKVANCNFSM42ZLJOKQ>
> .
>
--

*Nate MacInnes*

Business Technology Full-Stack Web Developer

Montreal, Canada (Remote)

***@***.***

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/richpeck/exception_handler/issues/101#issuecomment-817920146 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINUL5HSM63XFCLN3ARMS3TIMIWFANCNFSM42ZLJOKQ .

richpeck avatar Apr 12 '21 15:04 richpeck

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

yrashk avatar Jul 29 '21 05:07 yrashk

I'll look into this, and the eval problem, today

Rich

On 29/07/2021 06:25 Yurii Rashkovskii ***@***.***> wrote:




@richpeck https://github.com/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.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/richpeck/exception_handler/issues/101#issuecomment-888813556 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAINULY54PQTEPTWFGBQ763T2DQ5LANCNFSM42ZLJOKQ .

richpeck avatar Jul 29 '21 05:07 richpeck

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

richpeck avatar Jul 31 '21 19:07 richpeck

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

estebanz01 avatar Mar 16 '22 02:03 estebanz01

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

phortx avatar Jun 26 '22 17:06 phortx

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?

ikonomov17 avatar May 10 '23 11:05 ikonomov17