-
Notifications
You must be signed in to change notification settings - Fork 4k
chore: update django-webpack-loader constraint to allow newer versions #36676
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
base: master
Are you sure you want to change the base?
chore: update django-webpack-loader constraint to allow newer versions #36676
Conversation
Thanks for the pull request, @wgu-ram-chandra! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
afa81f7
to
e9487fa
Compare
Sandbox deployment failed 💥 |
Sandbox deployment successful 🚀 |
Sandbox deployment failed 💥 |
Fixes: #35276
Description
This PR updates the
django-webpack-loader
package from versionv0.7.0
to the latest compatible release,v3.1.1
. The update is made to enable better Webpack integration and to allow for future improvements.Supporting Information
Observed Changes Between v0.7.0 and v3.1.1
type="text/javascript"
andtype="text/css"
attributes from<script>
and<link>
tags (v1.3.0), as modern browsers no longer require them -> Not a breaking changeIGNORE
,POLL_INTERVAL
,TIMEOUT
, andINTEGRITY
settings inWEBPACK_LOADER
, giving more control over asset handling and subresource integrity checks -> Not a breaking changewebpack-bundle-tracker
integration -> Not a breaking changerender_bundle
template tag to accept an optional file extension filter for finer asset control -> Not a breaking changewebpack-stats.json
file, causing tests to fail due to the absence in the expected directory -> is a breaking changeIssue Summary
webpack-stats.json
file, which is required bydjango-webpack-loader
v3.1.1, was not being generated in thetest_data
directory as expected.npm run webpack
were not successful.Temporary Fix
STATIC_ROOT_LMS
andSTATIC_ROOT_CMS
were set incorrectly, causing Webpack to fail to generate the requiredwebpack-stats.json
file.npm run webpack
again, thewebpack-stats.json
file was successfully generated in the./test_root/staticfiles
folder and letting all tests to pass.Permanent Fix
django-webpack-loader
v3.1.1, I found theFakeWebpackLoader
class, which allows us to mock theget_bundle
method ofWebpackLoader
. This method is typically used in the template tag.FakeWebpackLoader
provides fake bundle data without requiring a realwebpack-stats.json
file, which effectively bypasses the Webpack build step in tests.monkeypatch(no_webpack_loader)
was removed, as it is no longer required in version v3.1.1. A new monkeypatch was added inconftest.py
to override therender_bundle
function, which prevents aTypeError
when tests are executed without a realwebpack-stats.json
file.webpack-stats.json
file, eliminating the need to build Webpack during test runs.Screenshot of the FakeWebpackLoader class from django-webpack-loader module
Codebase Impact
WEBPACK_LOADER
settings remain compatible with the new version of the package, with no changes required for existing settings.FakeWebpackLoader
integration prevents the need for a real Webpack build during tests.Steps Executed
Ran:
to upgrade the package.
Ran tests on the following sample files, which render HTML pages:
References: