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

read webpacker config to populate autoload paths #36803

Merged
merged 4 commits into from
Aug 15, 2019

Conversation

andrewkress
Copy link
Contributor

Summary

this change fixes the issue reported in #36799 when an environment is not in webpacker.yml. It will default to look in the production configuration.

Other Information

@rails-bot rails-bot bot added the railties label Jul 29, 2019
@andrewkress andrewkress force-pushed the fix-issue-36799 branch 4 times, most recently from 26fe16c to eed744c Compare July 30, 2019 18:56
@andrewkress andrewkress changed the title set webpacker_env to production if one isn't defined in webpacker.yml read webpacker config to populate autoload paths Jul 30, 2019
Copy link
Contributor

@abhaynikam abhaynikam left a comment

Choose a reason for hiding this comment

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

LGTM. I am not sure about the rescue part. Do we need to rescue so many things? And I think since we are doing early return rescue won't be necessary at all(I haven't checked this).

You might need to squash your commits in one. Thanks. Over to the team members now 😄

@andrewkress
Copy link
Contributor Author

Probably don’t need to rescue with the if statement put back in there. I can remove those and squash.

@andrewkress andrewkress force-pushed the fix-issue-36799 branch 2 times, most recently from cdf885e to fe2e9d3 Compare July 31, 2019 13:50
@andrewkress
Copy link
Contributor Author

added the rescue LoadError back in, because if the webpacker.yml file exists, but the gem has been removed, there will be a:
'require': cannot load such file -- webpacker (LoadError)


ActiveSupport::Dependencies.autoload_paths.each do |path|
assert_not_operator path, :ends_with?, "app/assets"
assert_not_operator path, :ends_with?, "app/webpack"
Copy link
Member

Choose a reason for hiding this comment

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

How is this test passing? We are not setting the config to webpack anywhere yet. Unless I'm missing something.

Copy link
Member

Choose a reason for hiding this comment

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

I added a new commit to this branch that makes this test fail if the config is not set.

@rafaelfranca rafaelfranca merged commit 9ad68a4 into rails:master Aug 15, 2019
rafaelfranca added a commit that referenced this pull request Aug 15, 2019
read webpacker config to populate autoload paths
@rafaelfranca
Copy link
Member

Thank you for working on this!

@andrewkress andrewkress deleted the fix-issue-36799 branch August 16, 2019 03:09
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 this pull request may close these issues.

None yet

5 participants