Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: autoImportPlugin 自动导入,影响了全局组件挂载 #1505

Closed
zdz23 opened this issue Mar 21, 2024 · 4 comments
Closed

🐛 [Bug]: autoImportPlugin 自动导入,影响了全局组件挂载 #1505

zdz23 opened this issue Mar 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@zdz23
Copy link

zdz23 commented Mar 21, 2024

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 代码



运行后,提示 router-view not find

What is expected

No response

What is actually happening

No response

What is your project name

练习的项目

Any additional comments (optional)

No response

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: autoImportPlugin is automatically imported, affecting global component mounting

@kagol kagol added the bug Something isn't working label Mar 28, 2024
@xakoy
Copy link

xakoy commented Mar 29, 2024

same question

@shenjunjian
Copy link
Collaborator

shenjunjian commented Aug 3, 2024

请参考最新官网文档, 插件 autoImportPlugin() 需要传入 'vite'参数,

经验证没有问题了

@Issues-translate-bot
Copy link

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants