tiny-vue
tiny-vue copied to clipboard
🐛 [Bug]: autoImportPlugin 自动导入,影响了全局组件挂载
Version
3.14.0
Vue Version
vue3
Link to minimal reproduction
nothing
Step to reproduce
vite.config.js 代码 import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' import AutoImport from 'unplugin-auto-import/vite' import autoImportPlugin from '@opentiny/unplugin-tiny-vue' import importPlugin from '@opentiny/vue-vite-import'
export default defineConfig({
plugins: [
vue(),
autoImportPlugin(),
AutoImport({ imports: ['vue', 'pinia', 'vue-router'], dts: false }),
importPlugin(
[
{
libraryName: '@opentiny/vue'
},
{
libraryName: @opentiny/vue-icon
,
customName: (name) => {
return @opentiny/vue-icon/lib/${name.replace(/^icon-/, '')}.js
}
}
],
'pc' // 此配置非必选,按需配置(pc|mobile|mobile-first)
)
],
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
// 设置路径
'~': path.resolve(__dirname, './'),
// 设置别名
'@': path.resolve(__dirname, './src')
},
// https://cn.vitejs.dev/config/#resolve-extensions
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
},
define: {
'process.env': { ...process.env }
}
})
App.vue 代码
What is expected
No response
What is actually happening
No response
What is your project name
练习的项目
Any additional comments (optional)
No response
Bot detected the issue body's language is not English, translate it automatically.
Title: 🐛 [Bug]: autoImportPlugin is automatically imported, affecting global component mounting
same question
请参考最新官网文档, 插件 autoImportPlugin() 需要传入 'vite'参数,
经验证没有问题了
Bot detected the issue body's language is not English, translate it automatically.
Refer to the latest documentation, the plug-in autoImportPlugin() needs to pass in the 'vite' parameter,