Closed xieyezi closed 8 months ago
And this is my vite user config :
config: {
configFile: false,
root: 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot',
},
optimizeDeps: { include: [ 'vue', 'vue-router' ] },
base: './',
plugins: [
{
name: 'vite:vue',
handleHotUpdate: [Function: handleHotUpdate],
config: [Function: config],
configResolved: [Function: configResolved],
configureServer: [Function: configureServer],
buildStart: [Function: buildStart],
resolveId: [AsyncFunction: resolveId],
load: [Function: load],
transform: [Function: transform]
},
{
name: 'vite:vue-jsx',
config: [Function: config],
configResolved: [Function: configResolved],
resolveId: [Function: resolveId],
load: [Function: load],
transform: [AsyncFunction: transform]
},
{
name: 'unplugin-vue-components',
enforce: 'post',
api: [Object],
transformInclude: [Function: transformInclude],
transform: [Function (anonymous)],
vite: [Object],
webpack: [Function: webpack],
configResolved: [Function: configResolved],
configureServer: [Function: configureServer]
},
[ [Object], [Object], [Object] ],
{
name: 'incall-build',
enforce: 'post',
apply: 'build',
configResolved: [Function: configResolved],
transformIndexHtml: [Function: transformIndexHtml]
}
],
resolve: {
alias: {
'@src': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src',
'@hooks': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\hooks',
'@views': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\views',
'@utils': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\utils',
'@assets': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\assets',
'@components': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\components',
'@stores': 'E:\\project\\incall-qiyuan-sdk\\packagesV3\\cloudRobot\\src\\stores'
}
},
build: {
target: 'es2015',
minify: 'terser',
outDir: 'E:\\project\\incall-qiyuan-sdk\\dist\\debug\\micro.cn.com.incall.cloudRobot',
cssCodeSplit: true,
sourcemap: true,
terserOptions: { compress: [Object] },
emptyOutDir: true
},
css: { postcss: { plugins: [Array] } },
server: {
port: 3000,
proxy: { '/api': 'https://dev-m.iov.changan.com.cn' },
host: '0.0.0.0'
}
}
The "unplugin-vue-components)" will automatically determine the version of Vue. However, in the case of a monorepo where both Vue 2 and Vue 3 versions exist in the top-level node_modules, it may face ambiguity in loading the appropriate version. Upon inspecting the corresponding source code, it was found that the plugin provides a "version" field to explicitly specify the version of Vue. Therefore, by simply setting "version: 3" in the configuration, this issue can be resolved.
Describe the bug
I use Vite JS API function:
createServer
function to create a vite server, and in option, I useunplugin-vue-components
andVantResolver
. It's compoile properly, But can not auto import vant componet.create Server:
I got warning like this:
And I use
vite-plugin-inspect
to look, I found that it's do not generate import statement auto:But if I use
vite dev
command to run, it's work properly:Reproduction
no
System Info
Used Package Manager
pnpm
Validations