mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 11:47:48 +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
|
pnpm-lock.yaml
|
||||||
CHANGELOG.en-US.md
|
CHANGELOG.en-US.md
|
||||||
!.*
|
!.*
|
||||||
|
docs/components.d.ts
|
||||||
|
@ -3,3 +3,4 @@ node_modules
|
|||||||
coverage
|
coverage
|
||||||
CHANGELOG.en-US.md
|
CHANGELOG.en-US.md
|
||||||
pnpm-lock.yaml
|
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 Inspect from 'vite-plugin-inspect'
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import WindiCSS from 'vite-plugin-windicss'
|
import WindiCSS from 'vite-plugin-windicss'
|
||||||
|
import glob from 'fast-glob'
|
||||||
|
|
||||||
import Components from 'unplugin-vue-components/vite'
|
import Components from 'unplugin-vue-components/vite'
|
||||||
import Icons from 'unplugin-icons/vite'
|
import Icons from 'unplugin-icons/vite'
|
||||||
import IconsResolver from 'unplugin-icons/resolver'
|
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 { projRoot } from './.vitepress/utils/paths'
|
||||||
import type { Alias } from 'vite'
|
import type { Alias } from 'vite'
|
||||||
|
|
||||||
@ -24,60 +27,67 @@ if (process.env.DOC_ENV !== 'production') {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default async () => {
|
||||||
server: {
|
const deps = getPackageDependencies(epPackage)
|
||||||
host: true,
|
const optimizeDeps = [
|
||||||
fs: {
|
'vue',
|
||||||
strict: true,
|
'@vue/shared',
|
||||||
allow: [projRoot],
|
'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: {
|
||||||
resolve: {
|
alias,
|
||||||
alias,
|
},
|
||||||
},
|
build: {
|
||||||
build: {
|
rollupOptions: {
|
||||||
rollupOptions: {
|
output: {
|
||||||
output: {
|
manualChunks: {
|
||||||
manualChunks: {
|
windicss: ['windicss'],
|
||||||
windicss: ['windicss'],
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
plugins: [
|
||||||
plugins: [
|
// https://github.com/antfu/unplugin-vue-components
|
||||||
// https://github.com/antfu/unplugin-vue-components
|
Components({
|
||||||
Components({
|
// custom resolvers
|
||||||
// custom resolvers
|
resolvers: [
|
||||||
resolvers: [
|
// auto import icons
|
||||||
// auto import icons
|
// https://github.com/antfu/unplugin-icons
|
||||||
// https://github.com/antfu/unplugin-icons
|
IconsResolver(),
|
||||||
IconsResolver(),
|
],
|
||||||
],
|
}),
|
||||||
}),
|
|
||||||
|
|
||||||
// https://github.com/antfu/unplugin-icons
|
// https://github.com/antfu/unplugin-icons
|
||||||
Icons({
|
Icons({
|
||||||
autoInstall: true,
|
autoInstall: true,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
WindiCSS(),
|
WindiCSS(),
|
||||||
Inspect(),
|
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',
|
|
||||||
],
|
],
|
||||||
},
|
optimizeDeps: {
|
||||||
})
|
include: optimizeDeps,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user