Browse Source

Optimize webpack chunks

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
Varun Patil 11 months ago
parent
commit
48e1a58345

+ 1 - 1
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'
 

+ 3 - 2
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()
 				}

+ 1 - 1
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',