element-plus/docs/vite.config.ts
三咲智子 d47047e680
fix(dev): fix playground and docs alias (#4068)
* fix(dev): fix playground and docs alias

* refactor: reorder import
2021-10-29 11:23:18 +08:00

37 lines
778 B
TypeScript

import path from 'path'
import Inspect from 'vite-plugin-inspect'
import { defineConfig } from 'vite'
import { projRoot } from './.vitepress/utils/paths'
import type { Alias } from 'vite'
const alias: Alias[] = []
if (process.env.DOC_ENV !== 'production') {
alias.push(
{
find: /^element-plus(\/(es|lib))?$/,
replacement: path.resolve(projRoot, 'packages/element-plus/index.ts'),
},
{
find: /^element-plus\/(es|lib)\/(.*)$/,
replacement: `${path.resolve(projRoot, 'packages')}/$2`,
}
)
}
export default defineConfig({
server: {
host: true,
fs: {
strict: true,
allow: [projRoot],
},
},
resolve: {
alias,
},
plugins: [Inspect()],
optimizeDeps: {
include: ['@vueuse/core', 'dayjs'],
},
})