Skip to content

Commit

Permalink
Perf: Improve time to render of Nextcloud via lazy-loading
Browse files Browse the repository at this point in the history
This will reduce the initial js bundle to be loaded on each NC page from 1.5MB to 150KB, with the rest of the code being immediately preloaded asynchronously

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
  • Loading branch information
marcelklehr committed Feb 13, 2023
1 parent 3de565a commit 9ef3214
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

import Vue from 'vue'
import NotificationsApp from './NotificationsApp.vue'

// Styles
import './styles/styles.scss'
Expand All @@ -30,9 +29,17 @@ Vue.prototype.n = n
Vue.prototype.OC = OC
Vue.prototype.OCA = OCA

// eslint-disable-next-line
__webpack_nonce__ = btoa(OC.requestToken);
// eslint-disable-next-line
__webpack_public_path__ = OC.linkTo('notifications', 'js/');

export default new Vue({
el: '#notifications',
// eslint-disable-next-line vue/match-component-file-name
name: 'NotificationsApp',
render: h => h(NotificationsApp),
components: {
NotificationsApp: () => import(/* webpackPreload: true */'./NotificationsApp.vue'),
},
render: h => h('NotificationsApp'),
})

0 comments on commit 9ef3214

Please sign in to comment.