element-plus/docs/vite.config.ts
三咲智子 a5dd21e94a
docs(build): refactor config & support dev without pre build (#3743)
* docs: refactor config

* docs(build): support dev without pre build

* docs: disable sourcemap
2021-09-30 19:26:30 +08:00

34 lines
701 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$/,
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()],
})