From c287d0ff5a32880dd0915d361cf711acf2d6a17d Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 23 Jun 2023 11:16:07 +0300 Subject: [PATCH] fixes --- Gruntfile.js | 4 ++- application/Espo/Core/Utils/ClientManager.php | 8 ------ client/src/loader.js | 25 ++++++++++++++++--- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index c33706ecca..3ed3543cf3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -152,11 +152,13 @@ module.exports = grunt => { uglify: { options: { - mangle: true, sourceMap: true, output: { comments: /^!/, }, + beautify: false, + mangle: true, + compress: true }, bundle: { options: { diff --git a/application/Espo/Core/Utils/ClientManager.php b/application/Espo/Core/Utils/ClientManager.php index f496456636..9597e20534 100644 --- a/application/Espo/Core/Utils/ClientManager.php +++ b/application/Espo/Core/Utils/ClientManager.php @@ -348,10 +348,6 @@ class ClientManager */ private function getTranspiledModuleList(): array { - if (!$this->isDeveloperMode()) { - return []; - } - $modules = array_values(array_filter( $this->module->getList(), fn ($item) => $this->module->get([$item, 'jsTranspiled']) @@ -368,10 +364,6 @@ class ClientManager */ private function getBundledModuleList(): array { - if (!$this->isDeveloperMode()) { - return []; - } - $modules = array_values(array_filter( $this->module->getList(), fn ($item) => $this->module->get([$item, 'bundled']) diff --git a/client/src/loader.js b/client/src/loader.js index fac3c94b03..ac226e8126 100644 --- a/client/src/loader.js +++ b/client/src/loader.js @@ -520,6 +520,23 @@ /** * @private + * @param {string} id + * @return {string} + */ + _restoreId(id) { + if (!id.includes(':')) { + return id; + } + + let [mod, part] = id.split(':'); + + return `modules/${mod}/${part}`; + } + + /** + * @private + * @param {string} id + * @return {string} */ _normalizeId(id) { if (id in this._aliasMap) { @@ -680,14 +697,16 @@ return; } - if (id in this._bundleMapping) { - let bundleName = this._bundleMapping[id]; + let restoredId = this._restoreId(id); + + if (restoredId in this._bundleMapping) { + let bundleName = this._bundleMapping[restoredId]; this._requireBundle(bundleName).then(() => { let value = this._get(id); if (typeof value === 'undefined') { - let msg = `Could not obtain module '${id}' from bundle '${bundleName}'.`; + let msg = `Could not obtain module '${restoredId}' from bundle '${bundleName}'.`; console.error(msg); throw new Error(msg);