mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 18:58:10 +08:00
docs: optimize deps when dev (#5434)
This commit is contained in:
parent
d2e482c592
commit
1d48642436
@ -3,3 +3,4 @@ dist
|
||||
pnpm-lock.yaml
|
||||
CHANGELOG.en-US.md
|
||||
!.*
|
||||
docs/components.d.ts
|
||||
|
@ -3,3 +3,4 @@ node_modules
|
||||
coverage
|
||||
CHANGELOG.en-US.md
|
||||
pnpm-lock.yaml
|
||||
docs/components.d.ts
|
||||
|
16
docs/components.d.ts
vendored
Normal file
16
docs/components.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
// generated by unplugin-vue-components
|
||||
// We suggest you to commit this file into source control
|
||||
// Read more: https://github.com/vuejs/vue-next/pull/3399
|
||||
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
IRiCodeLine: typeof import('~icons/ri/code-line')['default']
|
||||
IRiExternalLinkLine: typeof import('~icons/ri/external-link-line')['default']
|
||||
IRiFileCopy2Line: typeof import('~icons/ri/file-copy2-line')['default']
|
||||
IRiGithubLine: typeof import('~icons/ri/github-line')['default']
|
||||
IRiPlayCircleLine: typeof import('~icons/ri/play-circle-line')['default']
|
||||
IRiTranslate2: typeof import('~icons/ri/translate2')['default']
|
||||
}
|
||||
}
|
||||
|
||||
export { }
|
@ -2,11 +2,14 @@ import path from 'path'
|
||||
import Inspect from 'vite-plugin-inspect'
|
||||
import { defineConfig } from 'vite'
|
||||
import WindiCSS from 'vite-plugin-windicss'
|
||||
import glob from 'fast-glob'
|
||||
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import Icons from 'unplugin-icons/vite'
|
||||
import IconsResolver from 'unplugin-icons/resolver'
|
||||
|
||||
import { getPackageDependencies } from '../build/utils/pkg'
|
||||
import { epPackage } from '../build/utils/paths'
|
||||
import { projRoot } from './.vitepress/utils/paths'
|
||||
import type { Alias } from 'vite'
|
||||
|
||||
@ -24,60 +27,67 @@ if (process.env.DOC_ENV !== 'production') {
|
||||
)
|
||||
}
|
||||
|
||||
export default defineConfig({
|
||||
server: {
|
||||
host: true,
|
||||
fs: {
|
||||
strict: true,
|
||||
allow: [projRoot],
|
||||
export default async () => {
|
||||
const deps = getPackageDependencies(epPackage)
|
||||
const optimizeDeps = [
|
||||
'vue',
|
||||
'@vue/shared',
|
||||
'markdown-it',
|
||||
'clipboard-copy',
|
||||
'axios',
|
||||
'nprogress',
|
||||
...deps,
|
||||
]
|
||||
optimizeDeps.push(
|
||||
...(
|
||||
await glob(['lodash/[!_]*.js', 'dayjs/plugin/*.js'], {
|
||||
cwd: path.resolve(projRoot, 'node_modules'),
|
||||
onlyFiles: true,
|
||||
})
|
||||
).map((file) => file.replace(/\.js$/, ''))
|
||||
)
|
||||
|
||||
return defineConfig({
|
||||
server: {
|
||||
host: true,
|
||||
fs: {
|
||||
strict: true,
|
||||
allow: [projRoot],
|
||||
},
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias,
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
windicss: ['windicss'],
|
||||
resolve: {
|
||||
alias,
|
||||
},
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
windicss: ['windicss'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
// https://github.com/antfu/unplugin-vue-components
|
||||
Components({
|
||||
// custom resolvers
|
||||
resolvers: [
|
||||
// auto import icons
|
||||
// https://github.com/antfu/unplugin-icons
|
||||
IconsResolver(),
|
||||
],
|
||||
}),
|
||||
plugins: [
|
||||
// https://github.com/antfu/unplugin-vue-components
|
||||
Components({
|
||||
// custom resolvers
|
||||
resolvers: [
|
||||
// auto import icons
|
||||
// https://github.com/antfu/unplugin-icons
|
||||
IconsResolver(),
|
||||
],
|
||||
}),
|
||||
|
||||
// https://github.com/antfu/unplugin-icons
|
||||
Icons({
|
||||
autoInstall: true,
|
||||
}),
|
||||
// https://github.com/antfu/unplugin-icons
|
||||
Icons({
|
||||
autoInstall: true,
|
||||
}),
|
||||
|
||||
WindiCSS(),
|
||||
Inspect(),
|
||||
],
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'vue',
|
||||
'markdown-it',
|
||||
'clipboard-copy',
|
||||
'@vueuse/core',
|
||||
'axios',
|
||||
'nprogress',
|
||||
'@element-plus/icons-vue',
|
||||
'dayjs',
|
||||
'memoize-one',
|
||||
'async-validator',
|
||||
'lodash',
|
||||
'@popperjs/core',
|
||||
'normalize-wheel-es',
|
||||
WindiCSS(),
|
||||
Inspect(),
|
||||
],
|
||||
},
|
||||
})
|
||||
optimizeDeps: {
|
||||
include: optimizeDeps,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user