nuxt / components

Scan and auto import components for Nuxt.js 2.13+
MIT License
887 stars 48 forks source link

Doesn't work with Nuxt 2.15.3 #168

Closed apithy-isidro-martinez closed 3 years ago

apithy-isidro-martinez commented 3 years ago

It was working well, and just upgrade to Nuxt 2.15.3 from Nuxt 2.14.12 and in the browser shows errror that the components have not been registered

pi0 commented 3 years ago

Hi @apithy-isidro-martinez. A reproduction would be nice. But I guess you might check migration guide. A markdown file (.nuxt/components/readme.md) is being generated which you can check if any renaming required for component names.

apithy-isidro-martinez commented 3 years ago

According to the guide, then I have to specify the path of the folders that contain my components? image

pi0 commented 3 years ago

If you don't want component names to be prefixed (ie BaseAlert and NavigationLink), yes. Or you can disable pathPrefix for v1 behavior:

components: [
  { path: '~/components', pathPrefix: false }
]
WanyoikeJ commented 3 years ago

I have the same issue, Nearly the entire project was based in components auto discover but now its not working. am in version 2.15.3

kwolniak commented 3 years ago

IDK if it's the same problem but I have this error after update to nuxt 2.15.* during starting dev server:

TypeError: Cannot read property 'use' of undefined

        at WebpackBundler.<anonymous> (/usr/local/lib/node_modules/nuxt/node_modules/@nuxt/components/dist/index.js:114:17)
at next (node_modules/@nuxt/utils/dist/utils.js:659:27)
at WebpackBundler.<anonymous> (node_modules/@nuxt/utils/dist/utils.js:674:12)
at WebpackClientConfig.extendConfig (node_modules/@nuxt/webpack/dist/webpack.js:1509:37)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1544:50)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1708:26)
at WebpackBundler.getWebpackConfig (node_modules/@nuxt/webpack/dist/webpack.js:2016:19)
at WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2023:12)
at Builder.build (node_modules/@nuxt/builder/dist/builder.js:327:30)
at async Object._buildDev (/usr/local/lib/node_modules/nuxt/node_modules/@nuxt/cli/dist/cli-dev.js:106:5)
at async Object.startDev (/usr/local/lib/node_modules/nuxt/node_modules/@nuxt/cli/dist/cli-dev.js:64:7)
at async Object.run (/usr/local/lib/node_modules/nuxt/node_modules/@nuxt/cli/dist/cli-dev.js:51:5)
at async NuxtCommand.run (/usr/local/lib/node_modules/nuxt/node_modules/@nuxt/cli/dist/cli-index.js:2811:7)

do you have any idea what can cause it? If i set components: false the dev server starts but ofc I do not have components loaded.

sa8ab commented 3 years ago

Fixed to previous behavior by changing components: true to

components: [
  { path: '~/components', pathPrefix: false }
]

in nuxt.config.js

pi0 commented 3 years ago

I can confirm @sa8ab solution. If prefixing is not desired, can be disabled. Sorry for the inconvenience of v2 breaking changes added by 2.15... (new docs will make it better for pathPrefix usage)