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

Updated javascript guide to remove RequireJS references #36117

Merged
merged 12 commits into from
Apr 1, 2025

Conversation

orangejenny
Copy link
Contributor

@orangejenny orangejenny commented Mar 31, 2025

Safety Assurance

Safety story

Docs only

Automated test coverage

yes

QA Plan

no

Rollback instructions

  • This PR can be reverted after deploy with no further considerations

Labels & Review

  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@orangejenny orangejenny added the product/admin Change affects admin pages only visible to super users / staff label Mar 31, 2025
@orangejenny orangejenny requested a review from millerdev as a code owner March 31, 2025 17:33
Copy link
Contributor

@millerdev millerdev left a comment

Choose a reason for hiding this comment

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

🎉

Comment on lines -249 to -251
In order to ensure that the CDN has the most up to date version, we
append a version number to the end of the javascript file that is a sha
of the file. This infrastructure was already in place for cache busting.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we no longer do this? For my curiosity, how does Webpack do it? (I forget if I knew this and am just forgetting right now, or if it's a piece of Webpack infra I never realized existed.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Webpack embeds a hash in the filename itself (on production environments), so it's similar to django compressor. So we no longer need to do this for js, but we do still need to do it for other static assets (stylesheets, images - although it's possible to also use webpack to handle these down the road). There's a ticket files to update the static asset handling for the build process. I'm hoping to at least make it faster.

and unmigrated pages.
- `Bundler migration (RequireJS): dashboard <https://github.com/dimagi/commcare-hq/pull/19182/>`__ is an
example of an easy migration, where all dependencies are already migrated
- `Bundler proof of concept (with RequireJS) <https://github.com/dimagi/commcare-hq/pull/18116>`__ migrates a
Copy link
Contributor

Choose a reason for hiding this comment

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

It's unfortunate that these still mention RequireJS. I guess we do not have examples of migrating to Webpack? Do you know how hard it would be to create new ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a look at the linked PRs and decided to just remove this section: 23a6351 I don't think looking at those PRs (especially the massive old requirejs proof of concept PR!) will help anyone any more than just looking at production pages that use webpack. I'm also anticipating removing the docs fairly soon, once app manager is on webpack (it's currently in QA).

Comment on lines 51 to 53
1. Add ``js_entry`` tag and remove ``<script>`` tags
1. Add dependencies
1. Test
Copy link
Contributor

@millerdev millerdev Mar 31, 2025

Choose a reason for hiding this comment

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

@orangejenny orangejenny merged commit cb0c7cb into master Apr 1, 2025
13 checks passed
@orangejenny orangejenny deleted the jls/update-js-guide branch April 1, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/admin Change affects admin pages only visible to super users / staff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants