tiny-vue icon indicating copy to clipboard operation
tiny-vue copied to clipboard

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

Open zdz23 opened this issue 11 months ago • 2 comments

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

zdz23 avatar Mar 21 '24 11:03 zdz23

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


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

Issues-translate-bot avatar Mar 21 '24 11:03 Issues-translate-bot

same question

xakoy avatar Mar 29 '24 06:03 xakoy

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

经验证没有问题了

shenjunjian avatar Aug 03 '24 08:08 shenjunjian

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,

Issues-translate-bot avatar Aug 03 '24 08:08 Issues-translate-bot