From 5851725ee9967ea742139f49e4d6442fed114a0c Mon Sep 17 00:00:00 2001 From: Marcos Spessatto Defendi Date: Mon, 18 Mar 2019 11:49:07 -0300 Subject: [PATCH] Removing (almost) every dynamic imports (#13767) --- app/apps/server/bridges/messages.js | 7 +- app/apps/server/bridges/rooms.js | 8 +- app/apps/server/communication/rest.js | 83 +++++++++---------- app/authorization/client/startup.js | 4 +- .../client/views/permissionsRole.js | 11 +-- .../server/publications/permissions.js | 2 +- app/models/server/models/Messages.js | 14 +--- app/models/server/models/Subscriptions.js | 9 +- app/models/server/models/Users.js | 17 ++-- app/models/server/models/_BaseDb.js | 9 +- app/tokenpass/server/cronRemoveUsers.js | 8 +- .../client/models/CachedCollection.js | 2 +- app/ui/client/lib/esc.js | 6 +- app/utils/lib/templateVarHandler.js | 6 +- 14 files changed, 74 insertions(+), 112 deletions(-) diff --git a/app/apps/server/bridges/messages.js b/app/apps/server/bridges/messages.js index 7ddf3b422afa..b909a6ab46ad 100644 --- a/app/apps/server/bridges/messages.js +++ b/app/apps/server/bridges/messages.js @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { Random } from 'meteor/random'; import { Messages, Users, Subscriptions } from '../../../models'; import { Notifications } from '../../../notifications'; +import { updateMessage } from '../../../lib/server/functions/updateMessage'; export class AppMessageBridge { constructor(orch) { @@ -28,10 +29,6 @@ export class AppMessageBridge { async update(message, appId) { console.log(`The App ${ appId } is updating a message.`); - if (!this.updateMessage) { - const { updateMessage } = await import('../../../lib'); - this.updateMessage = updateMessage; - } if (!message.editor) { throw new Error('Invalid editor assigned to the message for the update.'); @@ -44,7 +41,7 @@ export class AppMessageBridge { const msg = this.orch.getConverters().get('messages').convertAppMessage(message); const editor = Users.findOneById(message.editor.id); - this.updateMessage(msg, editor); + updateMessage(msg, editor); } async notifyUser(user, message, appId) { diff --git a/app/apps/server/bridges/rooms.js b/app/apps/server/bridges/rooms.js index db2036d9fe9c..480cc946be71 100644 --- a/app/apps/server/bridges/rooms.js +++ b/app/apps/server/bridges/rooms.js @@ -1,6 +1,7 @@ import { Meteor } from 'meteor/meteor'; import { Rooms, Subscriptions, Users } from '../../../models'; import { RoomType } from '@rocket.chat/apps-engine/definition/rooms'; +import { addUserToRoom } from '../../../lib/server/functions/addUserToRoom'; export class AppRoomBridge { constructor(orch) { @@ -101,11 +102,6 @@ export class AppRoomBridge { async update(room, members = [], appId) { console.log(`The App ${ appId } is updating a room.`); - if (!this.addUserToRoom) { - const { addUserToRoom } = await import('../../../lib'); - this.addUserToRoom = addUserToRoom; - } - if (!room.id || !Rooms.findOneById(room.id)) { throw new Error('A room must exist to update.'); } @@ -121,7 +117,7 @@ export class AppRoomBridge { continue; } - this.addUserToRoom(rm._id, member); + addUserToRoom(rm._id, member); } } } diff --git a/app/apps/server/communication/rest.js b/app/apps/server/communication/rest.js index 5606bcb6b859..b397c701a0e8 100644 --- a/app/apps/server/communication/rest.js +++ b/app/apps/server/communication/rest.js @@ -1,9 +1,8 @@ import { Meteor } from 'meteor/meteor'; import { HTTP } from 'meteor/http'; +import { API } from '../../../api/server/api'; import Busboy from 'busboy'; -let _API; - export class AppsRestApi { constructor(orch, manager) { this._orch = orch; @@ -33,8 +32,6 @@ export class AppsRestApi { } async loadAPI() { - const { API } = await import('../../../api'); - _API = API; this.api = new API.ApiClass({ version: 'apps', useDefaultAuth: true, @@ -60,7 +57,7 @@ export class AppsRestApi { return info; }); - return _API.v1.success({ apps }); + return API.v1.success({ apps }); }, post() { let buff; @@ -69,7 +66,7 @@ export class AppsRestApi { const result = HTTP.call('GET', this.bodyParams.url, { npmRequestOptions: { encoding: 'base64' } }); if (result.statusCode !== 200 || !result.headers['content-type'] || result.headers['content-type'] !== 'application/zip') { - return _API.v1.failure({ error: 'Invalid url. It doesn\'t exist or is not "application/zip".' }); + return API.v1.failure({ error: 'Invalid url. It doesn\'t exist or is not "application/zip".' }); } buff = Buffer.from(result.content, 'base64'); @@ -78,7 +75,7 @@ export class AppsRestApi { } if (!buff) { - return _API.v1.failure({ error: 'Failed to get a file to install for the App. ' }); + return API.v1.failure({ error: 'Failed to get a file to install for the App. ' }); } const aff = Promise.await(manager.add(buff.toString('base64'), false)); @@ -91,7 +88,7 @@ export class AppsRestApi { info.status = 'compiler_error'; } - return _API.v1.success({ + return API.v1.success({ app: info, implemented: aff.getImplementedInferfaces(), compilerErrors: aff.getCompilerErrors(), @@ -106,7 +103,7 @@ export class AppsRestApi { languages: prl.getStorageItem().languageContent, })); - return _API.v1.success({ apps }); + return API.v1.success({ apps }); }, }); @@ -119,9 +116,9 @@ export class AppsRestApi { const info = prl.getInfo(); info.status = prl.getStatus(); - return _API.v1.success({ app: info }); + return API.v1.success({ app: info }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, post() { @@ -134,7 +131,7 @@ export class AppsRestApi { const result = HTTP.call('GET', this.bodyParams.url, { npmRequestOptions: { encoding: 'base64' } }); if (result.statusCode !== 200 || !result.headers['content-type'] || result.headers['content-type'] !== 'application/zip') { - return _API.v1.failure({ error: 'Invalid url. It doesn\'t exist or is not "application/zip".' }); + return API.v1.failure({ error: 'Invalid url. It doesn\'t exist or is not "application/zip".' }); } buff = Buffer.from(result.content, 'base64'); @@ -143,7 +140,7 @@ export class AppsRestApi { } if (!buff) { - return _API.v1.failure({ error: 'Failed to get a file to install for the App. ' }); + return API.v1.failure({ error: 'Failed to get a file to install for the App. ' }); } const aff = Promise.await(manager.update(buff.toString('base64'))); @@ -156,7 +153,7 @@ export class AppsRestApi { info.status = 'compiler_error'; } - return _API.v1.success({ + return API.v1.success({ app: info, implemented: aff.getImplementedInferfaces(), compilerErrors: aff.getCompilerErrors(), @@ -172,9 +169,9 @@ export class AppsRestApi { const info = prl.getInfo(); info.status = prl.getStatus(); - return _API.v1.success({ app: info }); + return API.v1.success({ app: info }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); @@ -187,9 +184,9 @@ export class AppsRestApi { if (prl) { const info = prl.getInfo(); - return _API.v1.success({ iconFileContent: info.iconFileContent }); + return API.v1.success({ iconFileContent: info.iconFileContent }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); @@ -202,9 +199,9 @@ export class AppsRestApi { if (prl) { const languages = prl.getStorageItem().languageContent || {}; - return _API.v1.success({ languages }); + return API.v1.success({ languages }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); @@ -228,9 +225,9 @@ export class AppsRestApi { const logs = Promise.await(orchestrator.getLogStorage().find(ourQuery, options)); - return _API.v1.success({ logs }); + return API.v1.success({ logs }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); @@ -249,21 +246,21 @@ export class AppsRestApi { } }); - return _API.v1.success({ settings }); + return API.v1.success({ settings }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, post() { console.log(`Updating ${ this.urlParams.id }'s settings..`); if (!this.bodyParams || !this.bodyParams.settings) { - return _API.v1.failure('The settings to update must be present.'); + return API.v1.failure('The settings to update must be present.'); } const prl = manager.getOneById(this.urlParams.id); if (!prl) { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } const { settings } = prl.getStorageItem(); @@ -277,7 +274,7 @@ export class AppsRestApi { } }); - return _API.v1.success({ updated }); + return API.v1.success({ updated }); }, }); @@ -288,14 +285,14 @@ export class AppsRestApi { try { const setting = manager.getSettingsManager().getAppSetting(this.urlParams.id, this.urlParams.settingId); - _API.v1.success({ setting }); + API.v1.success({ setting }); } catch (e) { if (e.message.includes('No setting found')) { - return _API.v1.notFound(`No Setting found on the App by the id of: "${ this.urlParams.settingId }"`); + return API.v1.notFound(`No Setting found on the App by the id of: "${ this.urlParams.settingId }"`); } else if (e.message.includes('No App found')) { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } else { - return _API.v1.failure(e.message); + return API.v1.failure(e.message); } } }, @@ -303,20 +300,20 @@ export class AppsRestApi { console.log(`Updating the App ${ this.urlParams.id }'s setting ${ this.urlParams.settingId }`); if (!this.bodyParams.setting) { - return _API.v1.failure('Setting to update to must be present on the posted body.'); + return API.v1.failure('Setting to update to must be present on the posted body.'); } try { Promise.await(manager.getSettingsManager().updateAppSetting(this.urlParams.id, this.bodyParams.setting)); - return _API.v1.success(); + return API.v1.success(); } catch (e) { if (e.message.includes('No setting found')) { - return _API.v1.notFound(`No Setting found on the App by the id of: "${ this.urlParams.settingId }"`); + return API.v1.notFound(`No Setting found on the App by the id of: "${ this.urlParams.settingId }"`); } else if (e.message.includes('No App found')) { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } else { - return _API.v1.failure(e.message); + return API.v1.failure(e.message); } } }, @@ -328,11 +325,11 @@ export class AppsRestApi { const prl = manager.getOneById(this.urlParams.id); if (prl) { - return _API.v1.success({ + return API.v1.success({ apis: manager.apiManager.listApis(this.urlParams.id), }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); @@ -343,14 +340,14 @@ export class AppsRestApi { const prl = manager.getOneById(this.urlParams.id); if (prl) { - return _API.v1.success({ status: prl.getStatus() }); + return API.v1.success({ status: prl.getStatus() }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, post() { if (!this.bodyParams.status || typeof this.bodyParams.status !== 'string') { - return _API.v1.failure('Invalid status provided, it must be "status" field and a string.'); + return API.v1.failure('Invalid status provided, it must be "status" field and a string.'); } console.log(`Updating ${ this.urlParams.id }'s status...`, this.bodyParams.status); @@ -359,9 +356,9 @@ export class AppsRestApi { if (prl) { const result = Promise.await(manager.changeStatus(prl.getID(), this.bodyParams.status)); - return _API.v1.success({ status: result.getStatus() }); + return API.v1.success({ status: result.getStatus() }); } else { - return _API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); + return API.v1.notFound(`No App found by the id of: ${ this.urlParams.id }`); } }, }); diff --git a/app/authorization/client/startup.js b/app/authorization/client/startup.js index 6b2e1dc398e2..f7ca7b7a8892 100644 --- a/app/authorization/client/startup.js +++ b/app/authorization/client/startup.js @@ -1,9 +1,9 @@ import { Meteor } from 'meteor/meteor'; import { CachedCollectionManager } from '../../ui-cached-collection'; import { hasAllPermission } from './hasPermission'; +import { AdminBox } from '../../ui-utils/client/lib/AdminBox'; -Meteor.startup(async() => { - const { AdminBox } = await import('../../ui-utils'); +Meteor.startup(() => { CachedCollectionManager.onLogin(() => Meteor.subscribe('roles')); diff --git a/app/authorization/client/views/permissionsRole.js b/app/authorization/client/views/permissionsRole.js index fb84f2f66e9c..86b1eea7f63e 100644 --- a/app/authorization/client/views/permissionsRole.js +++ b/app/authorization/client/views/permissionsRole.js @@ -5,10 +5,9 @@ import { Template } from 'meteor/templating'; import { t, handleError } from '../../../utils'; import { Roles } from '../../../models'; import { hasAllPermission } from '../hasPermission'; +import { modal } from '../../../ui-utils/client/lib/modal'; import toastr from 'toastr'; -let _modal; - Template.permissionsRole.helpers({ role() { return Roles.findOne({ @@ -113,12 +112,8 @@ Template.permissionsRole.helpers({ Template.permissionsRole.events({ async 'click .remove-user'(e, instance) { - if (!_modal) { - const { modal } = await import('../../../ui-utils'); - _modal = modal; - } e.preventDefault(); - _modal.open({ + modal.open({ title: t('Are_you_sure'), type: 'warning', showCancelButton: true, @@ -133,7 +128,7 @@ Template.permissionsRole.events({ return handleError(error); } - _modal.open({ + modal.open({ title: t('Removed'), text: t('User_removed'), type: 'success', diff --git a/app/authorization/server/publications/permissions.js b/app/authorization/server/publications/permissions.js index 2e8a6df20fe3..e98d745d58ae 100644 --- a/app/authorization/server/publications/permissions.js +++ b/app/authorization/server/publications/permissions.js @@ -1,5 +1,5 @@ import { Meteor } from 'meteor/meteor'; -import { Permissions } from '../../../models'; +import Permissions from '../../../models/server/models/Permissions'; import { Notifications } from '../../../notifications'; Meteor.methods({ diff --git a/app/models/server/models/Messages.js b/app/models/server/models/Messages.js index 0bf8576f53fd..11b002d80b24 100644 --- a/app/models/server/models/Messages.js +++ b/app/models/server/models/Messages.js @@ -3,6 +3,7 @@ import { Match } from 'meteor/check'; import { Base } from './_Base'; import Rooms from './Rooms'; import Users from './Users'; +import { settings } from '../../../settings/server/functions/settings'; import _ from 'underscore'; export class Messages extends Base { @@ -27,15 +28,6 @@ export class Messages extends Base { // threads this.tryEnsureIndex({ trid: 1 }, { sparse: true }); - - this.loadSettings(); - } - - loadSettings() { - Meteor.startup(async() => { - const { settings } = await import('../../../settings'); - this.settings = settings; - }); } setReactions(messageId, reactions) { @@ -727,7 +719,7 @@ export class Messages extends Base { groupable: false, }; - if (this.settings.get('Message_Read_Receipt_Enabled')) { + if (settings.get('Message_Read_Receipt_Enabled')) { record.unread = true; } @@ -756,7 +748,7 @@ export class Messages extends Base { groupable: false, }; - if (this.settings.get('Message_Read_Receipt_Enabled')) { + if (settings.get('Message_Read_Receipt_Enabled')) { record.unread = true; } diff --git a/app/models/server/models/Subscriptions.js b/app/models/server/models/Subscriptions.js index 32a29c9e1810..0bdef675eda7 100644 --- a/app/models/server/models/Subscriptions.js +++ b/app/models/server/models/Subscriptions.js @@ -3,6 +3,7 @@ import { Base } from './_Base'; import { Match } from 'meteor/check'; import Rooms from './Rooms'; import Users from './Users'; +import { getDefaultSubscriptionPref } from '../../../utils/lib/getDefaultSubscriptionPref'; import _ from 'underscore'; export class Subscriptions extends Base { @@ -1196,11 +1197,7 @@ export class Subscriptions extends Base { } // INSERT - async createWithRoomAndUser(room, user, extraData) { - if (!this.getDefaultSubscriptionPref) { - const Utils = await import('../../../utils'); - this.getDefaultSubscriptionPref = Utils.getDefaultSubscriptionPref; - } + createWithRoomAndUser(room, user, extraData) { const subscription = { open: false, alert: false, @@ -1218,7 +1215,7 @@ export class Subscriptions extends Base { username: user.username, name: user.name, }, - ...this.getDefaultSubscriptionPref(user), + ...getDefaultSubscriptionPref(user), ...extraData, }; diff --git a/app/models/server/models/Users.js b/app/models/server/models/Users.js index b9dc09c23cba..5de77ec39bec 100644 --- a/app/models/server/models/Users.js +++ b/app/models/server/models/Users.js @@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor'; import { Accounts } from 'meteor/accounts-base'; import { Base } from './_Base'; import Subscriptions from './Subscriptions'; +import { settings } from '../../../settings/server/functions/settings'; import _ from 'underscore'; import s from 'underscore.string'; @@ -17,14 +18,6 @@ export class Users extends Base { this.tryEnsureIndex({ statusConnection: 1 }, { sparse: 1 }); this.tryEnsureIndex({ type: 1 }); this.tryEnsureIndex({ 'visitorEmails.address': 1 }); - this.loadSettings(); - } - - loadSettings() { - Meteor.startup(async() => { - const { settings } = await import('../../../settings'); - this.settings = settings; - }); } getLoginTokensByUserId(userId) { @@ -219,7 +212,7 @@ export class Users extends Base { }, }; - if (this.settings.get('Livechat_show_agent_email')) { + if (settings.get('Livechat_show_agent_email')) { options.fields.emails = 1; } @@ -496,7 +489,7 @@ export class Users extends Base { const termRegex = new RegExp(s.escapeRegExp(searchTerm), 'i'); - const searchFields = forcedSearchFields || this.settings.get('Accounts_SearchFields').trim().split(','); + const searchFields = forcedSearchFields || settings.get('Accounts_SearchFields').trim().split(','); const orStmt = _.reduce(searchFields, function(acc, el) { acc.push({ [el.trim()]: termRegex }); @@ -844,13 +837,13 @@ export class Users extends Base { } setPreferences(_id, preferences) { - const settings = Object.assign( + const settingsObject = Object.assign( {}, ...Object.keys(preferences).map((key) => ({ [`settings.preferences.${ key }`]: preferences[key] })) ); const update = { - $set: settings, + $set: settingsObject, }; if (parseInt(preferences.clockMode) === 0) { delete update.$set['settings.preferences.clockMode']; diff --git a/app/models/server/models/_BaseDb.js b/app/models/server/models/_BaseDb.js index 69e21f2ba4a0..948daa49deb8 100644 --- a/app/models/server/models/_BaseDb.js +++ b/app/models/server/models/_BaseDb.js @@ -1,8 +1,8 @@ -import { Meteor } from 'meteor/meteor'; import { Match } from 'meteor/check'; import { Mongo, MongoInternals } from 'meteor/mongo'; import _ from 'underscore'; import { EventEmitter } from 'events'; +import { settings } from '../../../settings/server/functions/settings'; const baseName = 'rocketchat_'; @@ -56,11 +56,8 @@ export class BaseDb extends EventEmitter { } listenSettings() { - Meteor.startup(async() => { - const { settings } = await import('../../../settings'); - settings.get('Force_Disable_OpLog_For_Cache', (key, value) => { - isOplogEnabled = isOplogAvailable && value === false; - }); + settings.get('Force_Disable_OpLog_For_Cache', (key, value) => { + isOplogEnabled = isOplogAvailable && value === false; }); } diff --git a/app/tokenpass/server/cronRemoveUsers.js b/app/tokenpass/server/cronRemoveUsers.js index 0fe488703989..7edf7d1db60b 100644 --- a/app/tokenpass/server/cronRemoveUsers.js +++ b/app/tokenpass/server/cronRemoveUsers.js @@ -3,10 +3,10 @@ import { Rooms, Subscriptions, Users } from '../../models'; import { SyncedCron } from 'meteor/littledata:synced-cron'; import { updateUserTokenpassBalances } from './functions/updateUserTokenpassBalances'; import { Tokenpass } from './Tokenpass'; +import { removeUserFromRoom } from '../../lib/server/functions/removeUserFromRoom'; -async function removeUsersFromTokenChannels() { +function removeUsersFromTokenChannels() { const rooms = {}; - const { removeUserFromRoom } = await import('../../lib'); Rooms.findAllTokenChannels().forEach((room) => { rooms[room._id] = room.tokenpass; @@ -39,8 +39,8 @@ async function removeUsersFromTokenChannels() { } Meteor.startup(function() { - Meteor.defer(async function() { - await removeUsersFromTokenChannels(); + Meteor.defer(function() { + removeUsersFromTokenChannels(); SyncedCron.add({ name: 'Remove users from Token Channels', diff --git a/app/ui-cached-collection/client/models/CachedCollection.js b/app/ui-cached-collection/client/models/CachedCollection.js index 3cebf71f8804..9a31e3aaf9f4 100644 --- a/app/ui-cached-collection/client/models/CachedCollection.js +++ b/app/ui-cached-collection/client/models/CachedCollection.js @@ -6,6 +6,7 @@ import { ReactiveVar } from 'meteor/reactive-var'; import { Tracker } from 'meteor/tracker'; import localforage from 'localforage'; import { callbacks } from '../../../callbacks'; +import Notifications from '../../../notifications/client/lib/Notifications'; import _ from 'underscore'; class CachedCollectionManagerClass { @@ -346,7 +347,6 @@ export class CachedCollection { async setupListener(eventType, eventName) { Meteor.startup(async() => { - const { Notifications } = await import('../../../notifications'); const { RoomManager } = await import('../../../ui-utils'); const { ChatRoom, CachedChatRoom } = await import('../../../models'); Notifications[eventType || this.eventType](eventName || this.eventName, (t, record) => { diff --git a/app/ui/client/lib/esc.js b/app/ui/client/lib/esc.js index 6015ac4d62e4..07f90b33953a 100644 --- a/app/ui/client/lib/esc.js +++ b/app/ui/client/lib/esc.js @@ -1,5 +1,6 @@ import { SideNav } from '../../../ui-utils'; import { VideoRecorder } from './recorderjs/videoRecorder'; +import { VRecDialog } from '../../../ui-vrecord/client/VRecDialog'; const escapify = { init() { @@ -9,7 +10,7 @@ const escapify = { if (keyName === 'Escape') { that.sideNavIcon(); that.flextTabButton(); - that.videoDialog().then(); + that.videoDialog(); that.sweetAlerts(); } }, false); @@ -39,8 +40,7 @@ const escapify = { } }, - async videoDialog() { - const { VRecDialog } = await import('../../../ui-vrecord'); + videoDialog() { const vrecDialog = document.querySelector('.vrec-dialog'); if (vrecDialog && Number(window.getComputedStyle(vrecDialog).opacity) === 1) { VideoRecorder.stop(); diff --git a/app/utils/lib/templateVarHandler.js b/app/utils/lib/templateVarHandler.js index c384da3970c9..8b8070ca8961 100644 --- a/app/utils/lib/templateVarHandler.js +++ b/app/utils/lib/templateVarHandler.js @@ -3,10 +3,8 @@ import { Meteor } from 'meteor/meteor'; let logger; if (Meteor.isServer) { - Meteor.startup(async() => { - const { Logger } = await import('../../logger'); - logger = new Logger('TemplateVarHandler', {}); - }); + const { Logger } = require('../../logger/server/server'); + logger = new Logger('TemplateVarHandler', {}); } export const templateVarHandler = function(variable, object) {