|
|
|
@ -16,7 +16,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
|
import UnoCSS from 'unocss/vite'
|
|
|
|
import UnoCSS from 'unocss/vite'
|
|
|
|
|
|
|
|
|
|
|
|
export function createVitePlugins() {
|
|
|
|
export function createVitePlugins(isBuild = false) {
|
|
|
|
const root = process.cwd()
|
|
|
|
const root = process.cwd()
|
|
|
|
|
|
|
|
|
|
|
|
// 路径查找
|
|
|
|
// 路径查找
|
|
|
|
@ -24,7 +24,7 @@ export function createVitePlugins() {
|
|
|
|
return resolve(root, '.', dir)
|
|
|
|
return resolve(root, '.', dir)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
const plugins = [
|
|
|
|
Vue(),
|
|
|
|
Vue(),
|
|
|
|
VueJsx(),
|
|
|
|
VueJsx(),
|
|
|
|
UnoCSS(),
|
|
|
|
UnoCSS(),
|
|
|
|
@ -66,10 +66,6 @@ export function createVitePlugins() {
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
globs: ["src/components/**/**.{vue, md}", '!src/components/DiyEditor/components/mobile/**']
|
|
|
|
globs: ["src/components/**/**.{vue, md}", '!src/components/DiyEditor/components/mobile/**']
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
EslintPlugin({
|
|
|
|
|
|
|
|
cache: false,
|
|
|
|
|
|
|
|
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
VueI18nPlugin({
|
|
|
|
VueI18nPlugin({
|
|
|
|
runtimeOnly: true,
|
|
|
|
runtimeOnly: true,
|
|
|
|
compositionOnly: true,
|
|
|
|
compositionOnly: true,
|
|
|
|
@ -97,4 +93,16 @@ export function createVitePlugins() {
|
|
|
|
promiseImportName: (i) => `__tla_${i}`
|
|
|
|
promiseImportName: (i) => `__tla_${i}`
|
|
|
|
})
|
|
|
|
})
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ESLint 校验仅在开发环境启用,打包时跳过以提升构建速度(lint 应在开发/提交阶段单独执行)
|
|
|
|
|
|
|
|
if (!isBuild) {
|
|
|
|
|
|
|
|
plugins.push(
|
|
|
|
|
|
|
|
EslintPlugin({
|
|
|
|
|
|
|
|
cache: true,
|
|
|
|
|
|
|
|
include: ['src/**/*.vue', 'src/**/*.ts', 'src/**/*.tsx'] // 检查的文件
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return plugins
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|