Skip to content

Commit cb62d30

Browse files
committed
refactor: cleanup main entry point
module chunking is nowadays done automatically so we can simplify the entry point. Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 249e15f commit cb62d30

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

src/main.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,11 @@
55

66
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
77
import 'vite/modulepreload-polyfill'
8+
import Vue from 'vue'
9+
import DirectEditing from './views/DirectEditing.vue'
810

9-
if (document.getElementById('app-content')) {
10-
Promise.all([
11-
import(/* webpackChunkName: "editor" */'vue'),
12-
import(/* webpackChunkName: "editor" */'./views/DirectEditing.vue'),
13-
]).then((imports) => {
14-
const Vue = imports[0].default
15-
Vue.prototype.t = window.t
16-
Vue.prototype.OCA = window.OCA
17-
const DirectEditing = imports[1].default
18-
const vm = new Vue({
19-
render: h => h(DirectEditing),
20-
})
21-
vm.$mount(document.getElementById('app-content'))
22-
})
23-
}
11+
Vue.prototype.t = window.t
12+
Vue.prototype.OCA = window.OCA
13+
14+
const DirectView = Vue.extend(DirectEditing)
15+
new DirectView().$mount('#app-content')

src/viewer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5+
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
6+
import 'vite/modulepreload-polyfill'
57

68
import { logger } from './helpers/logger.js'
79
import { openMimetypesMarkdown, openMimetypesPlainText } from './helpers/mime.js'
8-
// eslint-disable-next-line import/no-unresolved, n/no-missing-import
9-
import 'vite/modulepreload-polyfill'
1010

1111
/**
1212
* Wrapper for async registration of ViewerComponent.

0 commit comments

Comments
 (0)