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

Setting ui.colorMode = false breaks nuxi typecheck #3657

Closed
teajaymars opened this issue Mar 23, 2025 · 1 comment
Closed

Setting ui.colorMode = false breaks nuxi typecheck #3657

teajaymars opened this issue Mar 23, 2025 · 1 comment
Labels
bug Something isn't working pro v3 #1289

Comments

@teajaymars
Copy link

teajaymars commented Mar 23, 2025

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

Nuxt v3.16.1
ui-pro v3.0.1

Reproduction

When I add the following to my nuxt.config.ts:

{
  ui: {
    colorMode: false
  }
}

...then npx nuxi typecheck fails with 8 errors.

[...snip]
node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeButton.vue:18:24 - error TS2305: Module '"#imports"' has no exported member 'useColorMode'.

18 import { useAppConfig, useColorMode } from '#imports'
                          ~~~~~~~~~~~~

node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeSelect.vue:10:24 - error TS2305: Module '"#imports"' has no exported member 'useColorMode'.

10 import { useAppConfig, useColorMode } from '#imports'
                          ~~~~~~~~~~~~

node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeSwitch.vue:10:24 - error TS2305: Module '"#imports"' has no exported member 'useColorMode'.

10 import { useAppConfig, useColorMode } from '#imports'
                          ~~~~~~~~~~~~


Found 8 errors in 8 files.

Errors  Files
     1  node_modules/@nuxt/ui-pro/dist/runtime/components/color-mode/ColorModeButton.vue:18
     1  node_modules/@nuxt/ui-pro/dist/runtime/components/color-mode/ColorModeSelect.vue:10
     1  node_modules/@nuxt/ui-pro/dist/runtime/components/color-mode/ColorModeSwitch.vue:10
     1  node_modules/@nuxt/ui-pro/dist/runtime/components/content/ContentSearch.vue:89
     1  node_modules/@nuxt/ui-pro/dist/runtime/components/DashboardSearch.vue:57
     1  node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeButton.vue:18
     1  node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeSelect.vue:10
     1  node_modules/@nuxt/ui-pro/dist/runtime/vue/components/ColorModeSwitch.vue:10

 ERROR  Process exited with non-zero status (2)

Description

I think that there probably needs to be a stub export set up in all cases? Or these files should not be gathered by the typechecking script?

Additional context

No response

Logs

@teajaymars teajaymars added bug Something isn't working triage v3 #1289 labels Mar 23, 2025
@varbSan
Copy link

varbSan commented Mar 24, 2025

I have the same issue when building my Vue SPA (without Nuxt).

It seems the issue comes from the vue typescript compiler --build flag.

temporary solution:

// package.json
❌ "type-check": "vue-tsc --build"
✅ "type-check": "vue-tsc --noEmit"

However, it doesn't seem to be a proper solution to me. I guess vue-tsc should just ignore the NuxtUI dependency by default.

further question:
auto-imports.d.ts and components.d.ts both have a series of type check ignoring comments.
Could the solution be to add the same type of comment for vue-tsc?

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

No branches or pull requests

3 participants