unplugin-auto-import
unplugin-auto-import copied to clipboard
Error: [auto-import] failed to load @vueuse/core, have you installed it?
[20:19:40] failed to load config from /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/vite.config.ts
[20:19:40] error during build:
[20:19:40] Error: [auto-import] failed to load @vueuse/core, have you installed it?
[20:19:40] at vueuse_core_default (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-T5OU4655.js:227:13)
[20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:39:51
[20:19:40] at Array.forEach (<anonymous>)
[20:19:40] at flattenImportsMap (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:34:36)
[20:19:40] at resolveOptions (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:18:19)
[20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:159:20
[20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin/dist/index.js:79:23
[20:19:40] at Object.<anonymous> (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/vite.config.ts:43:28)
[20:19:40] at Module._compile (internal/modules/cjs/loader.js:1251:30)
[20:19:40] at Object.require.extensions.<computed> [as .ts] (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@vite/dist/node/chunks/dep-1be34a63.js:77161:20)
[20:19:40] npm info lifecycle [email protected]~build: Failed to exec build script
[20:19:40] npm ERR! code ELIFECYCLE
[20:19:40] npm ERR! errno 1
[20:19:40] npm ERR! [email protected] build: `vue-tsc --noEmit && vite build`
[20:19:40] npm ERR! Exit status 1
[20:19:40] npm ERR!
[20:19:40] npm ERR! Failed at the [email protected] build script.
[20:19:40] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[20:19:40] npm timing npm Completed in 9112ms
[20:19:40]
[20:19:40] npm ERR! A complete log of this run can be found in:
this is my config
// https://github.com/antfu/unplugin-auto-import
AutoImport({
imports: [
'vue',
'vue-router',
'@vueuse/core',
'@vueuse/head'
],
dts: true,
}),
[20:19:40] failed to load config from /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/vite.config.ts [20:19:40] error during build: [20:19:40] Error: [auto-import] failed to load @vueuse/core, have you installed it? [20:19:40] at vueuse_core_default (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-T5OU4655.js:227:13) [20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:39:51 [20:19:40] at Array.forEach (<anonymous>) [20:19:40] at flattenImportsMap (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:34:36) [20:19:40] at resolveOptions (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:18:19) [20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin-auto-import/dist/chunk-5I5CMYBW.js:159:20 [20:19:40] at /root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@unplugin/dist/index.js:79:23 [20:19:40] at Object.<anonymous> (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/vite.config.ts:43:28) [20:19:40] at Module._compile (internal/modules/cjs/loader.js:1251:30) [20:19:40] at Object.require.extensions.<computed> [as .ts] (/root/workspace/wenzuo5_wenzuo-auth-fe_nfgy/node_modules/[email protected]@vite/dist/node/chunks/dep-1be34a63.js:77161:20) [20:19:40] npm info lifecycle [email protected]~build: Failed to exec build script [20:19:40] npm ERR! code ELIFECYCLE [20:19:40] npm ERR! errno 1 [20:19:40] npm ERR! [email protected] build: `vue-tsc --noEmit && vite build` [20:19:40] npm ERR! Exit status 1 [20:19:40] npm ERR! [20:19:40] npm ERR! Failed at the [email protected] build script. [20:19:40] npm ERR! This is probably not a problem with npm. There is likely additional logging output above. [20:19:40] npm timing npm Completed in 9112ms [20:19:40] [20:19:40] npm ERR! A complete log of this run can be found in:this is my config
// https://github.com/antfu/unplugin-auto-import AutoImport({ imports: [ 'vue', 'vue-router', '@vueuse/core', '@vueuse/head' ], dts: true, }),
试试在 vite.config.ts 的插件配置还有 tsconfig.json 的include字段里加一下配置?我之前用也有点报错信息,加上配置以后就好了
AutoImport({
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue\??/, // .vue
],
imports: [
'vue',
'vue-router',
'@vueuse/core',
'@vueuse/head'
],
dts: true
})
// tsconfig.json
"include": [
"auto-imports.d.ts"
]
Should be fixed with v0.4.5
when i use @vueuse/core 8.x, it also got this error
Should be fixed with v0.4.5
when i use @vueuse/core 8.x, it also got this error
Same here