Closed Bug 1441614 Opened 6 years ago Closed 6 years ago

Use ES6 imports for partials and remove cache-template.js

Categories

(Tree Management :: Treeherder: Frontend, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

Since:
* it's currently pretty broken - all partials are bundled with every page (ie perfherder ones in the jobs view and vice versa)
   -> this is only going to be more of an issue as the React work progresses (since the proportion of perf to not-perf partials will increase)
* there are apparently a number of issues with templateUrl vs template:
   -> https://medium.com/@frosty/angularjs-template-vs-templateurl-cdde055b7907
* it's one less AngularJS specific thing to worry about for the React migration

For anything using templateUrl (ie directives/components) we can just switch to an `import` of the template and passing it to `template`. 

However for `ng-includes` we'll still need to populate the template cache, but can do so manually for just the specific partials that are used by each page (switching to ng-cache-loader or similar would be overkill at this point).
Depends on: 1441617
Attachment #8955002 - Flags: review?(cdawson)
Attachment #8955002 - Flags: review?(cdawson) → review+
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/038e60a8333741ea43b237b55a92cf9eebb89525
Bug 1441614 - Use imports for templates instead of cache-template.js (#3286)

Previously all templates were being included on every page, regardless
of whether they were being used, bloating the bundles. In addition,
`templateUrl` has a number of issues compared to `template`:
https://medium.com/@frosty/angularjs-template-vs-templateurl-cdde055b7907

There are now no more instances of non-global `require()`s (or any
require()s for that matter), so we can enable that eslint rule:
https://eslint.org/docs/rules/global-require

Improves the bundle sizes as follows:
* index: -60KB
* logviewer: -138KB
* perf: -84KB
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: