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

uninitialized constant ReactOnRails::Configuration::Webpacker #1621

Closed
adriangohjw opened this issue May 20, 2024 · 6 comments · Fixed by #1622
Closed

uninitialized constant ReactOnRails::Configuration::Webpacker #1621

adriangohjw opened this issue May 20, 2024 · 6 comments · Fixed by #1622
Labels

Comments

@adriangohjw
Copy link
Contributor

Environment

Ruby version: 3.3.1
Rails version: 7.1.3.2
Shakapacke version: 8.0.0
React on Rails version: 14.0.0

Expected behavior

Running rails s should start the server successfully

Actual behavior

Facing this error and server refuse to start up

.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/react_on_rails-14.0.0/lib/react_on_rails/configuration.rb:261:in `shakapacker_precompile?': uninitialized constant ReactOnRails::Configuration::Webpacker (NameError)

Webpacker.config.shakapacker_precompile?

Details

Changing Webpacker.config.shakapacker_precompile? to Shakapacker.config.shakapacker_precompile? seem to fix the issue (on my end, at least)

def shakapacker_precompile?
return Webpacker.config.webpacker_precompile? if ReactOnRails::WebpackerUtils.using_shakapacker_6?
Webpacker.config.shakapacker_precompile?
end

@justin808
Copy link
Member

@adriangohjw can you update spec/dummy app to use Shakapacker v8?

@adriangohjw
Copy link
Contributor Author

@justin808 done! e1c1b2d

@4-Eyes
Copy link

4-Eyes commented Jun 23, 2024

I can confirm this bug still exists, event though the associated PR has been closed. As a workaround until this is fixed, I've just put an initializer in my app that sets Webpacker to Shakapacker, as shown below:

# app/config/initializers/webpacker.rb
Webpacker = Shakapacker

@sophiedeziel
Copy link

I confirm @4-Eyes 's hack worked for me.

@aarestad
Copy link

For the record, it looks like a fix was supposed to have be merged in #1629.

@justin808
Copy link
Member

#1622 will fix this.

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

Successfully merging a pull request may close this issue.

5 participants