1 Star 16 Fork 6

free pan/archetype-backend-template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
viteOptimizeDeps.ts 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
import { readdirSync, accessSync } from 'fs'
import { DepOptimizationOptions } from 'vite'
export function optimizeDepsIncludes(
mode: string
): DepOptimizationOptions | undefined {
if (mode === 'development') {
const optimizeDepsIncludes = ['element-plus/es']
readdirSync('node_modules/element-plus/es/components').map(dirname => {
try {
accessSync(
`node_modules/element-plus/es/components/${dirname}/style/css.mjs`
)
optimizeDepsIncludes.push(
`element-plus/es/components/${dirname}/style/css`
)
} catch (error) {
// console.log(error)
}
})
readdirSync('node_modules/tinymce/plugins').map(dirname => {
try {
accessSync(`node_modules/tinymce/plugins/${dirname}/index.js`)
optimizeDepsIncludes.push(`tinymce/plugins/${dirname}`)
} catch (error) {
// console.log(error)
}
})
optimizeDepsIncludes.push(`core-js/actual/promise`)
optimizeDepsIncludes.push(`tinymce/tinymce`)
optimizeDepsIncludes.push(`@tinymce/tinymce-vue`)
optimizeDepsIncludes.push(`tinymce/themes/silver`)
optimizeDepsIncludes.push(`tinymce/icons/default`)
console.log(
`预构建数量[${optimizeDepsIncludes.length}], 内容: \n${optimizeDepsIncludes}`
)
return { include: optimizeDepsIncludes }
}
return undefined
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/free_pan/archetype-backend-template.git
git@gitee.com:free_pan/archetype-backend-template.git
free_pan
archetype-backend-template
archetype-backend-template
develop

搜索帮助

0d507c66 1850385 C8b1a773 1850385