Add a setting to configure skip common chunks behaviour globally #318
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 is untested code but I am wondering if there is an appetite for a feature like this which would allow you to setskip_common_chunks
per config without having to addskip_common_chunks=True
to all of yourrender_bundle
template tags. I realize this is likely an edge case but it would be helpful to have it as a setting instead of solely a template tag option.You can now specify a
SKIP_COMMON_CHUNKS
setting globally for each Webpack configuration. This will perform the sameskip_common_chunks
logic from therender_bundle
template tag without having to add a parameter to every tag.To maintain backwards compatibility we default to 'False' and allow common chunks to be rendered to the HTML document as script tags. In the future, it will be easy to change this default behaviour if desired.
I've added test coverage to ensure that the global setting can be overridden by the existing template tag parameter and that we maintain backward compatibility.