diff --git a/client/src/loader.js b/client/src/loader.js index 863bf91fd2..6f62c2be47 100644 --- a/client/src/loader.js +++ b/client/src/loader.js @@ -626,7 +626,13 @@ } this._bundlePromiseMap[name] = new Promise(resolve => { - let list = dependencies.map(item => Espo.loader.requirePromise(item)); + let list = dependencies.map(item => { + if (item.indexOf('bundle!') === 0) { + return this._requireBundle(item.substring(7)); + } + + return Espo.loader.requirePromise(item); + }); Promise.all(list) .then(() => this._addBundle(name)) @@ -861,7 +867,7 @@ /** * @param {string} name A bundle name. - * @param {string} list Dependencies.. + * @param {string[]} list Dependencies. * @internal */ mapBundleDependencies: function (name, list) { @@ -1003,7 +1009,7 @@ /** * @param {string} name A bundle name. - * @param {string} list Dependencies.. + * @param {string[]} list Dependencies. * @internal */ mapBundleDependencies: function (name, list) { diff --git a/frontend/bundle-config.json b/frontend/bundle-config.json index 6cbf11cf04..6f60fc427f 100644 --- a/frontend/bundle-config.json +++ b/frontend/bundle-config.json @@ -89,6 +89,7 @@ "client/src/views/lead-capture/**/*.js", "client/src/views/lead-capture-log-record/**/*.js", "client/src/views/webhooks/**/*.js", + "client/src/views/layout-set/**/*.js", "client/src/controllers/admin.js", "client/src/controllers/inbound-email.js", "client/src/controllers/layout-set.js", @@ -97,7 +98,11 @@ "client/src/controllers/portal-role.js" ], "templatePatterns": [ - "client/res/templates/admin/**/*.tpl" + "client/res/templates/admin/**/*.tpl", + "client/res/templates/lead-capture/**/*.tpl", + "client/res/templates/scheduled-job/**/*.tpl", + "client/res/templates/settings/**/*.tpl", + "client/res/templates/settings/**/*.tpl" ] }, "crm": { @@ -119,7 +124,9 @@ "dependentOn": [ "lib!Summernote" ], - "requiredLibs": ["Summernote"], + "requires": [ + "lib!Summernote" + ], "lookupPatterns": [ "client/modules/crm/src/**/*.js" ] @@ -132,7 +139,10 @@ "lib!Flotr", "lib!espo-funnel-chart" ], - "requiredLibs": ["Flotr", "espo-funnel-chart"], + "requires": [ + "lib!Flotr", + "lib!espo-funnel-chart" + ], "lookupPatterns": [ "client/modules/crm/src/**/*.js" ] @@ -144,7 +154,9 @@ "dependentOn": [ "lib!full-calendar" ], - "requiredLibs": ["full-calendar"], + "requires": [ + "lib!full-calendar" + ], "lookupPatterns": [ "client/modules/crm/src/**/*.js" ] @@ -156,7 +168,9 @@ "dependentOn": [ "lib!vis" ], - "requiredLibs": ["vis"], + "requires": [ + "lib!vis" + ], "lookupPatterns": [ "client/modules/crm/src/**/*.js" ] diff --git a/js/bundler-general.js b/js/bundler-general.js index 124bedff5e..6b11daa984 100644 --- a/js/bundler-general.js +++ b/js/bundler-general.js @@ -40,7 +40,7 @@ class BundlerGeneral { * templatePatterns?: string[], * noDuplicates?: boolean, * dependentOn?: string[], - * requiredLibs?: string[], + * requires?: string[], * }>, * modulePaths?: Record., * lookupPatterns: string[], @@ -97,10 +97,10 @@ class BundlerGeneral { let bundleFile = this.filePattern.replace('{*}', name); - let libs = this.config.chunks[name].requiredLibs; + let requires = this.config.chunks[name].requires; - if (libs) { - let part = JSON.stringify(libs.map(item => 'lib!' + item)); + if (requires) { + let part = JSON.stringify(requires); result[mainName] += `Espo.loader.mapBundleDependencies('${name}', ${part});\n`; }