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

Webpacker::VERSION not present in v4.2.0 #943

Open
andywww12 opened this issue Sep 4, 2020 · 3 comments
Open

Webpacker::VERSION not present in v4.2.0 #943

andywww12 opened this issue Sep 4, 2020 · 3 comments

Comments

@andywww12
Copy link

Guys,

On version 2.1.0 of the gem when running on Webpacker version 4.2.0, the styles aren't getting included because of a guard clause checking for Webpacker::VERSION which doesn't seem to exist on a vanilla 4.2.0 install.

https://github.com/mileszs/wicked_pdf/blob/master/lib/wicked_pdf/wicked_pdf_helper/assets.rb#L174

irb(main):001:0> Webpacker::VERSION
Traceback (most recent call last):
        1: from (irb):1
NameError (uninitialized constant Webpacker::VERSION)
irb(main):002:0>```
@kulas115
Copy link

I was investigating this as well and I think the problem here is that webpacker is not required at all. This condition is not met in my case so I also get NameError: uninitialized constant Webpacker::VERSION.

I've tried to comment out that guard clause and put binding.pry there. When running require 'webpacker/version' if defined?(Webpacker) manually it loads webpacker and Webpacker::VERSION is defined and returns the correct version. That in the end yields correct CSS.

Maybe the problem stems from the fact that this require is conditional on defined?(Webpacker) and at this point, it's not defined yet?

@unixmonkey
Copy link
Collaborator

Perhaps instead of checking the version there, we check for the existence of the method?

if defined?(asset_pack_url)
  asset_pack_url(source)
else

Does that work for any of you?
If it does, could someone create a pull request?

@filipkis
Copy link

This is still an issue and there is potentially addressed by PR #964 which should be merged.

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

4 participants