Merge pull request #2491 from overleaf/as-unvendor-moment

Unvendor moment from the frontend

GitOrigin-RevId: 19ffc42a2d3e6eecfbec42575a0472f992c8abda
This commit is contained in:
Jessica Lawshe 2020-01-07 09:23:54 -06:00 committed by Copybot
parent 1a1a387301
commit f2943054fb
5 changed files with 8 additions and 20 deletions

View file

@ -6,7 +6,6 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
const version = { const version = {
moment: '2.9.0',
ace: '1.4.5', // Upgrade instructions: https://github.com/overleaf/write_latex/wiki/Upgrading-Ace ace: '1.4.5', // Upgrade instructions: https://github.com/overleaf/write_latex/wiki/Upgrading-Ace
fineuploader: '5.15.4', fineuploader: '5.15.4',
algolia: '2.5.2' algolia: '2.5.2'

View file

@ -10,7 +10,7 @@
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/ */
define(['base', 'moment'], function(App, moment) { define(['base', 'moment'], function(App, moment) {
moment.locale('en', { moment.updateLocale('en', {
calendar: { calendar: {
lastDay: '[Yesterday]', lastDay: '[Yesterday]',
sameDay: '[Today]', sameDay: '[Today]',

View file

@ -1,4 +1,4 @@
define(['base', 'moment'], (App, moment) => define(['base'], App =>
App.controller('BinaryFileController', function( App.controller('BinaryFileController', function(
$scope, $scope,
$rootScope, $rootScope,

File diff suppressed because one or more lines are too long

View file

@ -195,13 +195,8 @@ module.exports = {
alias: { alias: {
// Aliases for AMD modules // Aliases for AMD modules
// Vendored dependencies in public/src/vendor/libs (e.g. angular) // Shortcut to vendored dependencies in frontend/js/vendor/libs
libs: path.join(__dirname, 'frontend/js/vendor/libs'), libs: path.join(__dirname, 'frontend/js/vendor/libs'),
// Use vendored moment (with correct version)
moment: path.join(
__dirname,
`frontend/js/vendor/libs/${PackageVersions.lib('moment')}`
),
// Enables ace/ace shortcut // Enables ace/ace shortcut
ace: path.join( ace: path.join(
__dirname, __dirname,
@ -249,10 +244,11 @@ module.exports = {
writeToFileEmit: true writeToFileEmit: true
}), }),
// Silence warning when loading moment from vendored dependencies as it // Prevent moment from loading (very large) locale files that aren't used
// attempts to load locales.js file which does not exist (but this is fine new webpack.IgnorePlugin({
// as we don't want to load the large amount of locale data from moment) resourceRegExp: /^\.\/locale$/,
new webpack.IgnorePlugin(/^\.\/locale$/, /frontend\/js\/vendor\/libs/), contextRegExp: /moment$/
}),
new CopyPlugin([ new CopyPlugin([
{ {