Coder Social home page Coder Social logo

Comments (6)

Baiyuetribe avatar Baiyuetribe commented on May 29, 2024 2

Maybe you can try restart
有时候是需要重启生效的,未来或许可以解决

from nuxt3-naive-ui-starter.

JorgenSQ avatar JorgenSQ commented on May 29, 2024

With naive-ui
image

Without naive-ui
image

from nuxt3-naive-ui-starter.

Baiyuetribe avatar Baiyuetribe commented on May 29, 2024

Please make sure your configuration is correct. I have used it in an official environment and had no problems.

import { defineNuxtConfig } from 'nuxt3'
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
    build: {
        transpile: ['naive-ui', 'vueuc'],   // fix dev error: Cannot find module 'vueuc'
    },
    vite: {
        plugins: [
            Components({
                resolvers: [NaiveUiResolver()], // Automatically register all components in the `components` directory
            }),
        ],
        // @ts-expect-error: Missing ssr key
        ssr: {
            noExternal: ['moment', 'naive-ui'],
        },
    }
})

I suggest git clone, then npm install, and try starting it again。If you have modified the nuxt.config.js file, please restart the npm command.

from nuxt3-naive-ui-starter.

xboxfly15 avatar xboxfly15 commented on May 29, 2024

Hot reloading doesn't work if there's naive-ui elements in a page in the pages directory. Hot reloading only works if you use app.vue

from nuxt3-naive-ui-starter.

everatch avatar everatch commented on May 29, 2024

 我也发生同样的问题,但只发生在自己写的 component 上。

<n-card>
  <atoms-graph-basic /> // from /components/atoms/graph/basic.vue
</n-card>

第一次读取没有问题,
当我改变这文件, <n-card> 读取正常,而 <atoms-graph-basic /> 会出错误如下
(貌似这问题只出现在 client 环境下?)

スクリーンショット 2022-03-11 3 32 45

我也尝试用 vite 自动读取我的 component,但问题没有解决,仍然出现的同样错误

vite: {
  plugins: [
    Components({
      dirs: ['components'],
      directoryAsNamespace: true,
      resolvers: [NaiveUiResolver()], // Automatically register all components in the `components` directory
    }),
  ],
},

from nuxt3-naive-ui-starter.

faisalindrianto avatar faisalindrianto commented on May 29, 2024

hello, i encountered this also when I create page inside "pages" folder, it's only work on app.vue, got the same error as @JorgenSQ

Screen Shot 2022-06-10 at 21 35 14

Screen Shot 2022-06-10 at 21 36 18

from nuxt3-naive-ui-starter.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.