unplugin-vue-components icon indicating copy to clipboard operation
unplugin-vue-components copied to clipboard

resolvers for naive-ui not working with version 0.27.*

Open Lucas0819 opened this issue 1 year ago • 4 comments

Describe the bug

I have tried with version 0.27.0 - 0.27.3, and all of them doesn't work at all

// vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [NaiveUiResolver()],
    }),
  ],
})

// main.js
import { createApp } from 'vue'
import App from './App.vue'

const app = createApp(App)
app.mount('#app')
<!-- App.vue -->
<template>
  <NConfigProvider />
</template>

Error message:

chunk-H2P5RRWN.js?v=2fdc74b2:1558 [Vue warn]: Failed to resolve component: NConfigProvider If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement. at App

Dependencies version:

"vue": "3.4.31",
"vite": "5.3.4", "@vitejs/plugin-vue": "5.1.0",

Reproduction

http://localhost:5173/

System Info

System:
    OS: macOS 14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 304.89 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.4 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 10.7.0 - /usr/local/bin/npm
    pnpm: 9.6.0 - /usr/local/bin/pnpm
    Watchman: 2024.04.08.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 126.0.6478.185

Used Package Manager

npm

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • [X] The provided reproduction is a minimal reproducible of the bug.

Lucas0819 avatar Jul 25 '24 03:07 Lucas0819

image image Do not change the include order

xiaoyang5116 avatar Jul 30 '24 03:07 xiaoyang5116

I also encountered a similar problem. My local development and use were normal. After Vite was built, all introduced styles were lost, causing page exceptions. I tried to reproduce the minimal implementation of this defect, but it could not be reproduced after just introducing navie-ui to build it. It is speculated that it is caused by using other frameworks at the same time. The code snippet for uploading the problem needs to be determined. currently locked to v0.26.0 to ensure normal online functions. I will continue to pay attention to this issue

caser993 avatar Aug 07 '24 05:08 caser993

Hi! We had similar issue as well for versions v0.27.0. But was able to resolve by upgrading to v0.27.4. I think it might be tied to #767 which was addressed in v0.27.4 via #768

jtmiclat avatar Oct 14 '24 14:10 jtmiclat

I have a similar problem, but it occurred in .tsx. After changed to .vue it worked.

hellorayza avatar Nov 05 '24 09:11 hellorayza