Use Rails.application.config_for to load the webpacker.yml #2795
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds support for 'erb' compilation of webpacker.yml config files.
Without this change, webpacker.yml will forever live on it's own and be responsible for loading a config file manually and work in unexpected ways, like ERB compilation not working inside of webpacker.yml loading similar to how all other config files work.
After this change, webpacker.yml will now act like every other "rails" yml file that people are used to and things like the below will evaluate properly when the environment is set properly
Internally, this is a small change, we use the Rails.application.config_for method that is used for all other configuration loads and handles erb compilation.
I looked through the github history and this did not seem like a design decision to intentionally not include compilation.
Closes: #1615