From 48e1a5834585703e435fc562629e48113e3e2485 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 16 May 2023 16:22:15 -0700 Subject: Optimize webpack chunks Signed-off-by: Varun Patil --- apps/comments/src/components/Comment.vue | 2 +- apps/files_sharing/src/files_sharing_tab.js | 5 +++-- webpack.common.js | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/comments/src/components/Comment.vue b/apps/comments/src/components/Comment.vue index 5c58ec8b1fd..7ccf6204aa1 100644 --- a/apps/comments/src/components/Comment.vue +++ b/apps/comments/src/components/Comment.vue @@ -110,7 +110,7 @@ import NcActions from '@nextcloud/vue/dist/Components/NcActions.js' import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js' import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' -import NcRichContenteditable from '@nextcloud/vue/dist/Components/NcRichContenteditable.js' +const NcRichContenteditable = () => import('@nextcloud/vue/dist/Components/NcRichContenteditable') import RichEditorMixin from '@nextcloud/vue/dist/Mixins/richEditor.js' import ArrowRight from 'vue-material-design-icons/ArrowRight.vue' diff --git a/apps/files_sharing/src/files_sharing_tab.js b/apps/files_sharing/src/files_sharing_tab.js index 96bd207fa8a..bdce38304b1 100644 --- a/apps/files_sharing/src/files_sharing_tab.js +++ b/apps/files_sharing/src/files_sharing_tab.js @@ -24,7 +24,6 @@ import Vue from 'vue' import { translate as t, translatePlural as n } from '@nextcloud/l10n' -import SharingTab from './views/SharingTab.vue' import ShareSearch from './services/ShareSearch.js' import ExternalLinkActions from './services/ExternalLinkActions.js' import ExternalShareActions from './services/ExternalShareActions.js' @@ -46,7 +45,6 @@ Vue.prototype.t = t Vue.prototype.n = n // Init Sharing tab component -const View = Vue.extend(SharingTab) let TabInstance = null window.addEventListener('DOMContentLoaded', function() { @@ -57,6 +55,9 @@ window.addEventListener('DOMContentLoaded', function() { iconSvg: ShareVariant, async mount(el, fileInfo, context) { + const SharingTab = (await import('./views/SharingTab.vue')).default + const View = Vue.extend(SharingTab) + if (TabInstance) { TabInstance.$destroy() } diff --git a/webpack.common.js b/webpack.common.js index 9f1d34cba39..7638d579fcc 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -143,11 +143,11 @@ module.exports = { optimization: { splitChunks: { automaticNameDelimiter: '-', + minChunks: 3, // minimum number of chunks that must share the module cacheGroups: { vendors: { // split every dependency into one bundle test: /[\\/]node_modules[\\/]/, - enforce: true, // necessary to keep this name to properly inject it // see OC_Template.php name: 'core-common', -- cgit v1.2.3