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

Nuxt 3 module autoimport is not working correctly #6773

Open
4 of 5 tasks
ellie-web opened this issue Feb 22, 2025 · 0 comments
Open
4 of 5 tasks

Nuxt 3 module autoimport is not working correctly #6773

ellie-web opened this issue Feb 22, 2025 · 0 comments
Labels
untriaged need to sort

Comments

@ellie-web
Copy link

ellie-web commented Feb 22, 2025

Describe the bug

following the official docs for Nuxt integration gives you error 500

Steps to reproduce

Following the steps described in docs:

  1. npx nuxi module add nuxtjs-naive-ui
  2. npm i unplugin-auto-import
  3. npm i unplugin-vue-components
  4. add missing config to nuxt.config.ts from the example in the docs
  5. add Naive UI components in one of your templates, <n-time/> in my case

get the following error:

[plugin:vite:import-analysis] Failed to resolve import "naive-ui" from "components/posts/Card/ReadOnly.vue". Does the file exist?

20 |  function _createElementVNode(...args) { return _interopVNode(__createElementVNode(...args)) }
21 |  /* Injection by vite-plugin-vue-inspector End */
22 |  /* unplugin-vue-components disabled */import { NTime as __unplugin_components_0 } from 'naive-ui';
   |                                                                                          ^
23 |  import { defineComponent as _defineComponent } from "vue";
24 |

I managed to fix it by manually running npm i naive-ui, so its seems like a bug in one of the packages mentioned above, or maybe its the intended behavior? in that case please update the docs, right now it seems like installing the nuxt module is enough

Link to minimal reproduction

https://codesandbox.io/p/sandbox/nuxt-naive-ui-autoimport-bug-7t3jkh

System Info

npmPackages:
  naive-ui: ^2.41.0 => 2.41.0
  vue: latest => 3.5.13

Used Package Manager

npm

Validations

@ellie-web ellie-web added the untriaged need to sort label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
untriaged need to sort
Projects
None yet
Development

No branches or pull requests

1 participant