Package
v4.x
Description
We know that Nuxt UI uses unplugin-auto-import and unplugin-vue-components vite plugins, which should generate the files:
auto-imports.d.ts
components.d.ts
on development/production environments.
The problem is that these declaration files are generated by Vite plugins, while the default Vue project boilerplate currently uses the following build setup:
{
"name": "vue-project",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "run-p type-check \"build-only {@}\" --",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build"
},
"dependencies": {
"vue": "^3.5.40"
}
}
The build script above runs two processes in parallel : type-checking, vite build process.
This can create a race condition, because vue-tsc can possibly start before the Vite plugins, that have generated the required declaration files.
For example, a clean build may fail with a message like this:
error TS2304: Cannot find name 'useToast'.
This is expected because vue-tsc has no knowledge of the Nuxt UI auto-imports until auto-imports.d.ts has been generated.
I think it worth mentioning in Vue specific docs, as this is the default boilerplate of package.json that many people use.
Additional context
No response
Package
v4.x
Description
We know that Nuxt UI uses
unplugin-auto-importandunplugin-vue-componentsvite plugins, which should generate the files:auto-imports.d.tscomponents.d.tson development/production environments.
The problem is that these declaration files are generated by Vite plugins, while the default Vue project boilerplate currently uses the following
buildsetup:{ "name": "vue-project", "version": "0.0.0", "private": true, "type": "module", "scripts": { "dev": "vite", "build": "run-p type-check \"build-only {@}\" --", "preview": "vite preview", "build-only": "vite build", "type-check": "vue-tsc --build" }, "dependencies": { "vue": "^3.5.40" } }The
buildscript above runs two processes in parallel : type-checking, vite build process.This can create a race condition, because
vue-tsccan possibly start before the Vite plugins, that have generated the required declaration files.For example, a clean build may fail with a message like this:
This is expected because vue-tsc has no knowledge of the Nuxt UI auto-imports until auto-imports.d.ts has been generated.
I think it worth mentioning in Vue specific docs, as this is the default boilerplate of
package.jsonthat many people use.Additional context
No response