Skip to content

Improve the condition of webpacker major version #895

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

Merged
merged 1 commit into from
May 17, 2018

Conversation

6br
Copy link
Contributor

@6br 6br commented May 17, 2018

Summary

I found server-side rendering failed in our environment Rails 5.2, webpacker 4.0.0.pre.pre.2, webpack 4.4.1. The error message is following.

Failure/Error: <%= react_component("SearchFilter", {}, {prerender: true}) %>

     ActionView::Template::Error:
       No such file or directory @ rb_sysopen - public/server_rendering-0c232d693da2fd422ba9.js
     # ./app/views/users/_filter.html.erb:2:in `_app_views_recipes__filter_html_erb___2340570384952592713_70205888111860'
     # ./app/views/users/index.html.erb:6:in `_app_views_users_index_html_erb___4199468956611823080_70205888379400'
     # ------------------

The path public/server_rendering-0c232d693da2fd422ba9.js is not proper because my webpacker.yaml is following. public/packs/server_rendering-0c232d693da2fd422ba9.js is correct.

default: &default
  source_path: app/javascript
  source_entry_path: packs
  public_output_path: packs
  cache_path: tmp/cache/webpacker

Since it depends on the version of webpacker, I mofidied lib/react/server_rendering/webpacker_manifest_container.rb.

@BookOfGreg
Copy link
Member

Good catch, thank you for the fix!

Copy link
Member

@ttanimichi ttanimichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 We probably don’t have to add test cases to https://github.com/reactjs/react-rails/blob/a91e0d84a5ce3d0aafe56d1d9410a533efafd272/test/react/server_rendering/webpacker_manifest_container_test.rb . But, it seems that we need to do some more work to support webpacker v4. e.g. Add gemfiles which contains it.

@ttanimichi ttanimichi merged commit 20c98b1 into reactjs:master May 17, 2018
@ttanimichi
Copy link
Member

@6br Nice catch. Thanks! ✨

@ttanimichi
Copy link
Member

Pushed 467cbd8 which is related to this PR.

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

Successfully merging this pull request may close these issues.

3 participants