Remove hqdefine and use_js_bundler
Technical Summary
https://dimagi.atlassian.net/browse/SAAS-17490 and https://dimagi.atlassian.net/browse/SAAS-17489
Safety Assurance
Safety story
This touches a lot of files, but it's small, systematic changes. The main risks are js in hqwebapp (which admittedly is used on virtually all pages), app manager, and web apps. I've smoke tested app manager and web apps and will put this on staging.
Marking don't merge because I'd like to let https://github.com/dimagi/commcare-hq/pull/36419 be live for a little bit before merging this (which will make it hard to roll back that PR).
Automated test coverage
No.
QA Plan
No.
Rollback instructions
- [x] This PR can be reverted after deploy with no further considerations
Labels & Review
- [x] Risk label is set correctly
- [x] The set of people pinged as reviewers is appropriate for the level of risk of the change
Not linting.
@biyeun Can you say more about what kind of testing you'd have QA do for this? I don't think it justifies regression testing everything. The bulk of it is renames that webpack is already doing.
Added commits to remove use_js_bundler, which I was going to do as a separate piece of cleanup, but it conflicts with the hqDefine removal so that would get annoying.
@orangejenny who will be in charge of getting this over the finish line?
@MartinRiese I can take it, assuming it goes smoothly. I'm planning to merge it the week after next (I'm offline next week, and at that point webpack on form builder, which I'm still a little nervous about, will have been live for a little bit). If any issues come up that mean it takes more time, then I might seek out someone to wrap it up.
Added a few AMD to ESM conversions.
Hi Jenny, I saw in some cases, hqDefine is changed to import, in other cases, hqDefine is changed to define. Wondering what is making the difference?
I'm thinking if I should do the same thing for those define files: https://github.com/dimagi/commcare-hq/pull/36502
@jingcheng16 Good question. hqDefine is changed to a series of import statements for files that can be converted to ES6. hqDefine is converted to define for files that are not yet converted to ES6. Converting them to define just means that they're now using standard AMD syntax, and I'm removing HQ's custom hqDefine function. If you check out the diff in this PR for webpack/webpack.common.js, you'll see that in webpack files, we were already replacing any hqDefine calls with a define call.
Why didn't I just convert everything to ES6? I haven't converted cloudcare because there's some complexity there, so those files are still using AMD, and then any files that cloudcare depends on are also still on AMD.
I believe that all of the files you touched in https://github.com/dimagi/commcare-hq/pull/36502/ are being converted to ES6 in this PR.
Not sure if change hqDefine to define in main.js requires us import textchange plugin explicitly. But I think we can always address it in another PR. I'll go verify it locally, later this afternoon.
@jingcheng16 I think textchange should be imported in whatever files use it. I'm going to merge this PR because it's enormous, but after that I can take a look at textchange.