-
-
Notifications
You must be signed in to change notification settings - Fork 630
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
Update Helper to Check for Bundle with correct Extension #1511
Changes from 4 commits
a4bbcac
4e55bb7
5fb4f35
b70d505
5bd188d
66c7bfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,8 +94,7 @@ def react_component(component_name, options = {}) | |
end | ||
|
||
def load_pack_for_component(component_name) | ||
component_pack_file = generated_components_pack(component_name) | ||
is_component_pack_present = File.exist?("#{component_pack_file}.jsx") | ||
is_component_pack_present = File.exist?(generated_components_pack_path(component_name)) | ||
is_development = ENV["RAILS_ENV"] == "development" | ||
|
||
if is_development && !is_component_pack_present | ||
|
@@ -109,8 +108,10 @@ def load_pack_for_component(component_name) | |
append_stylesheet_pack_tag "generated/#{component_name}" | ||
end | ||
|
||
def generated_components_pack(component_name) | ||
"#{ReactOnRails::WebpackerUtils.webpacker_source_entry_path}/generated/#{component_name}" | ||
def generated_components_pack_path(component_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be part of the helper? or not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be a private member |
||
extension = PacksGenerator.generated_pack_extension | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this customizable? Why not always There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not configurable! It's always js There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then why not a constant? |
||
|
||
"#{ReactOnRails::WebpackerUtils.webpacker_source_entry_path}/generated/#{component_name}.#{extension}" | ||
end | ||
|
||
# react_component_hash is used to return multiple HTML strings for server rendering, such as for | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this part of the public helper?
there's no doc for this method
load_pack_for_component
or
generated_components_pack_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be private member as it is used internally by
react_component
andreact_component_hash