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

11670 Make webpack add filehashes to all (read: entrypoint) js files in build #11724

Open
wants to merge 14 commits into
base: dev/8.0.x
Choose a base branch
from

Conversation

whatisgalen
Copy link
Member

@whatisgalen whatisgalen commented Jan 10, 2025

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

This PR creates a webpack_manifest (essentially just a lookup for files to their actual webpack asset filename) so that all .js files can be saved using a filehash in the filename, thereby forcing a cache burst on end-user browser clients whenever novel changes get pushed to a deployment. This is effective on both dev and prod builds.

The base.py view now looks up the asset corresponding to the main_script value.

See webpack-manifest-plugin for more docs

Note that there is an assumption in where the manifest should be looked for:

...
manifest_path = os.path.join(settings.APP_ROOT, "media/build", "manifest.json")

...and it's possible this should search a list of locations instead.

Issues Solved

Closes #11670

Testing this PR

You will need to add:

"webpack-manifest-plugin": "5.0.0"

to your project dependencies and run npm install to install webpack_manifest. You'll also want to run both a production and development build of webpack. All "main_views" should be tested, e.g.

  • rdm
  • views/graph
  • views/graph-designer
  • views/graph/model-history
  • views/graph/function-manager
  • views/map-layer-manager
  • views/plugin
  • views/resource
  • views/resource-editor
  • views/edit-history
  • views/edit-log
  • views/report
  • views/search
  • views/user-profile

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Accessibility Checklist

Developer Guide

Topic Changed Retested
Color contrast
Form fields
Headings
Links
Keyboard
Responsive Design
HTML validation
Screen reader

Ticket Background

  • Sponsored by:
  • Found by: @
  • Tested by: @
  • Designed by: @

Further comments

@whatisgalen whatisgalen marked this pull request as draft January 10, 2025 20:09
@whatisgalen whatisgalen changed the title 11670 hashed files 11670 Make webpack add filehashes to all js files in build Jan 10, 2025
@whatisgalen whatisgalen requested a review from chrabyrd January 10, 2025 20:18
@whatisgalen whatisgalen marked this pull request as ready for review January 12, 2025 03:25
@whatisgalen
Copy link
Member Author

whatisgalen commented Jan 13, 2025

making a note to self and others that when ultimately approved, the changes to the frontend webpack utils files (like build-filepath and webpack.common) need to be duplicated in the arches-templates directory's versions of those files.
done ✅

@whatisgalen whatisgalen changed the title 11670 Make webpack add filehashes to all js files in build 11670 Make webpack add filehashes to all (read: entrypoint) js files in build Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

some webpack-built files are named with their file hash while others aren't
1 participant