stable

Clone or download

Read-only

request #12943: Reduce size of document.js bundle

Our dependency moment-timezone includes all possible timezones with all date ranges, producing a too big document.js bundle ≃1.24 MiB. Ideally we should be able to load asynchronously each timezone. However, for a quick and short term solution I suggest to remove all dates that are after the next year (current year of the bundle generation + 1 to avoid glitches at the beginning of 2020). In document view, the only purpose of moment-timezone is to display last update date of a document (date which is in the past). There is no plan to manage dates in the future. Furthermore, since we are using regular timestamp to store the creation/update date of a document/folder, no need to to keep dates that are before the epoch year (1970). By using https://github.com/gilmoreorless/moment-timezone-data-webpack-plugin, we can significantly reduce the size of the bundle. Before: Entrypoints: document (1.24 MiB) document-d69b0619b1d9a26f3389.js After: Entrypoints: document (476 KiB) document-c9b5a8412a5d91001fa3.js Change-Id: I86df48e4a9857ceb4058af865c8ce6ef62014909

Modified Files

Name
M plugins/document/scripts/package-lock.json +100 −0 Go to diff View file
M plugins/document/scripts/package.json +2 −1 Go to diff View file
M plugins/document/scripts/webpack.config.js +6 −1 Go to diff View file