chore: 使用vite-plugin-uni-components实现组件和类型的自动导入
This commit is contained in:
parent
0bb2d56aa3
commit
43a3232368
@ -122,6 +122,7 @@
|
||||
"@types/wechat-miniprogram": "^3.4.8",
|
||||
"@uni-helper/uni-types": "1.0.0-alpha.3",
|
||||
"@uni-helper/unocss-preset-uni": "^0.2.11",
|
||||
"@uni-helper/vite-plugin-uni-components": "^0.2.0",
|
||||
"@uni-helper/vite-plugin-uni-layouts": "^0.1.10",
|
||||
"@uni-helper/vite-plugin-uni-manifest": "^0.2.8",
|
||||
"@uni-helper/vite-plugin-uni-pages": "0.2.20",
|
||||
|
7059
pnpm-lock.yaml
generated
7059
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@ import { visualizer } from 'rollup-plugin-visualizer'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import ViteRestart from 'vite-plugin-restart'
|
||||
import { copyNativeRes } from './vite-plugins/copyNativeRes'
|
||||
import Components from '@uni-helper/vite-plugin-uni-components'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default async ({ command, mode }) => {
|
||||
@ -67,7 +68,6 @@ export default async ({ command, mode }) => {
|
||||
UniPlatform(),
|
||||
UniManifest(),
|
||||
// UniXXX 需要在 Uni 之前引入
|
||||
Uni(),
|
||||
{
|
||||
// 临时解决 dcloudio 官方的 @dcloudio/uni-mp-compiler 出现的编译 BUG
|
||||
// 参考 github issue: https://github.com/dcloudio/uni-app/issues/4952
|
||||
@ -122,6 +122,13 @@ export default async ({ command, mode }) => {
|
||||
}),
|
||||
// 只有在 app 平台时才启用 copyNativeRes 插件
|
||||
UNI_PLATFORM === 'app' && copyNativeRes(),
|
||||
Components({
|
||||
extensions: ['vue'],
|
||||
deep: true, // 是否递归扫描子目录,
|
||||
directoryAsNamespace: false, // 是否把目录名作为命名空间前缀,true 时组件名为 目录名+组件名,
|
||||
dts: 'src/types/components.d.ts', // 自动生成的组件类型声明文件路径(用于 TypeScript 支持)
|
||||
}),
|
||||
Uni(),
|
||||
],
|
||||
define: {
|
||||
__UNI_PLATFORM__: JSON.stringify(UNI_PLATFORM),
|
||||
|
Loading…
x
Reference in New Issue
Block a user