我的项目 JS 大约 680 kb。我添加了 vuetify-tiptap 编辑器,现在 JS 为 1338 kb。
我在https://www.npmjs.com/package/tiptap-vuetify#installation中加载这样的插件
在vuetify.js
:
import Vue from 'vue'
import Vuetify from 'vuetify/lib'
import { TiptapVuetifyPlugin } from 'tiptap-vuetify'
import 'tiptap-vuetify/dist/main.css'
const vuetify = new Vuetify()
Vue.use(Vuetify)
Vue.use(TiptapVuetifyPlugin, {
// the next line is important! You need to provide the Vuetify Object to this place.
vuetify, // same as "vuetify: vuetify"
// optional, default to 'md' (default vuetify icons before v2.0.0)
iconsGroup: 'mdi'
})
然后我在组件中使用tiptap ( Editor.vue
)
<tiptap-vuetify v-if="!disabled"
v-model="content"
:extensions="extensions"
:disabled="disabled"
/>
JS:
import { TiptapVuetify, Heading, Bold, Italic, Strike, Underline, Code, Paragraph, BulletList, OrderedList, ListItem, Link, Blockquote, HardBreak, HorizontalRule, History } from 'tiptap-vuetify'
components: { TiptapVuetify },
data() {
return {
// declare extensions you want to use
extensions: [
History,
Blockquote,
Link,
Underline,
Strike,
Italic,
ListItem,
BulletList,
OrderedList,
[Heading, {
options: {
levels: [1, 2, 3]
}
}],
Bold,
Code,
HorizontalRule,
Paragraph,
HardBreak
],
// starting editor's content
content: this.model
}
}
有没有办法只在需要时加载所有内容或减少 chunk-vendors.js?