Remove Moment.js
Moment.js is only used in a single place, for converting ISO8601 date-time strings from the annotation's 'updated' field to user-friendly date strings (eg. 'Wednesday 17 Dec, 18:59') for the tooltips for the last-updated link in the annotation card. Replacing this with functions from the built-in Date object saves 167KB from the generated bundle size (see moment/min/moment-with-locales.min.js) and also speeds up the digest cycle. For 20 annotation cards in the /stream view, generating the date string used to take 6-7ms with Moment. It takes <2ms with the built in functions in a current build of Chrome. This still shows up as the most expensive watch expression, so we might want to add caching as well.
Showing
... | ... | @@ -39,7 +39,6 @@ |
"is-equal-shallow": "^0.1.3", | ||
"jquery": "1.11.1", | ||
"js-polyfills": "^0.1.11", | ||
"moment": "^2.10.6", | ||
"ng-tags-input": "2.2.0", | ||
"node-uuid": "^1.4.3", | ||
"postcss": "^5.0.6", | ||
... | ... | @@ -95,8 +94,7 @@ |
"annotator": "./h/static/scripts/vendor/annotator.js", | ||
"angular": "./node_modules/angular/angular.js", | ||
"hammerjs": "./node_modules/hammerjs/hammer.js", | ||
"jquery": "./node_modules/jquery/dist/jquery.js", | ||
"moment": "./node_modules/moment/min/moment-with-locales.js" | ||
"jquery": "./node_modules/jquery/dist/jquery.js" | ||
}, | ||
"browserify-shim": { | ||
"annotator": { | ||
... | ... |
Please register or sign in to comment