perf: add vite optimize deps (#467)
This commit is contained in:
parent
29f9b87128
commit
b13f1725f1
@ -37,7 +37,7 @@ export function markdownPowerPlugin(
|
||||
addViteOptimizeDepsInclude(
|
||||
bundlerOptions,
|
||||
app,
|
||||
['artplayer', 'dashjs', 'hls.js', 'mpegts.js'],
|
||||
['artplayer', 'dashjs', 'hls.js', 'mpegts.js/dist/mpegts.js'],
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
@ -5,6 +5,7 @@ import type {
|
||||
LineNumberOptions,
|
||||
PreWrapperOptions,
|
||||
} from './types.js'
|
||||
import { addViteOptimizeDepsInclude } from '@vuepress/helper'
|
||||
import { isPlainObject } from 'vuepress/shared'
|
||||
import { colors } from 'vuepress/utils'
|
||||
import { copyCodeButtonPlugin } from './copy-code-button/index.js'
|
||||
@ -94,12 +95,22 @@ export function shikiPlugin({
|
||||
extendsMarkdownOptions: (options) => {
|
||||
// 注入 floating-vue 后,需要关闭 代码块 的 v-pre 配置
|
||||
if ((options as any).vPre !== false) {
|
||||
const vPre = isPlainObject((options as any).vPre) ? (options as any).vPre : { block: true }
|
||||
const vPre = isPlainObject(options.vPre) ? options.vPre : { block: true }
|
||||
if (vPre.block) {
|
||||
(options as any).vPre ??= {}
|
||||
options.vPre ??= {}
|
||||
;(options as any).vPre.block = false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
extendsBundlerOptions: (bundlerOptions, app) => {
|
||||
if (options.twoslash) {
|
||||
addViteOptimizeDepsInclude(
|
||||
bundlerOptions,
|
||||
app,
|
||||
['floating-vue'],
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user