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

Components loading failing with using the content module #223

Closed
kalinichenko88 opened this issue Aug 12, 2021 · 6 comments
Closed

Components loading failing with using the content module #223

kalinichenko88 opened this issue Aug 12, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@kalinichenko88
Copy link

kalinichenko88 commented Aug 12, 2021

Describe the bug

In dev mode all works. But nuxt generate and nuxt build failed with the error

  • If a component is registered in the page it will work fine
  • issue with autoloaded components only
  • I solved this issue for myself. I added in package.json "@nuxt/components": "2.1.8"

To Reproduce
Steps to reproduce the behavior:

  1. Clone repository https://github.com/kalinichenko88/nuxt-components-bug
  2. Run npm i
  3. Run npm run generate
  4. See error Error: render function or template not defined in component: tutorial
@chrispreisler
Copy link

chrispreisler commented Aug 13, 2021

I also experienced the same bug, when using the plugin with dynamic components like this:

    <component
      :is="componentName"
      :data="story.content"
    />

I stepped back to 2.1.8 with yarn resolutions like this:

"resolutions": {
  "@nuxt/components": "2.1.8"
}

There I don't have any problems. It is also only happening, when building/generating the page.

@rchl
Copy link

rchl commented Aug 13, 2021

I'm using undocumented components: { loader: true } in my nuxt-config and with that the https://github.com/nuxt/components/releases/tag/v2.2.0 appears to have a breaking change. Most likely due to:

Even more annoying that it doesn't trigger in development so the issue is only discovered after deploying.

@chrispreisler
Copy link

Yes, I also think, that this feature may be a breaking change for dynamic components. I also tried adding async to the filename, but this doesn't work either.

@rchl
Copy link

rchl commented Aug 13, 2021

I'm getting errors like: ERROR render function or template not defined in component: foo-bar-v-2 with the new version.

What would be a way to get things to work for someone who uses loader: true (apart from downgrading)?

@pi0 pi0 self-assigned this Aug 13, 2021
@pi0 pi0 added the bug Something isn't working label Aug 13, 2021
@pi0 pi0 closed this as completed in 0fec884 Aug 16, 2021
@pi0
Copy link
Member

pi0 commented Aug 16, 2021

Thanks for reproduction @kalinichenko88. Just remove package-lock.json (or yarn.lock) and reinstall dependencies. The issue is fixed in v2.2.1.

kkeisuke added a commit to kkeisuke/kkeisuke-blog that referenced this issue Aug 17, 2021
components/global が読み込まれない現象が改善された
nuxt/components#223
@ibdf
Copy link

ibdf commented Sep 15, 2021

I am still having this issue, but it fails without an error. The vue component in the .md files load perfectly in the dev environment but not when using generate or build. I am on:

"@nuxt/content": "^1.11.1",
"nuxt": "^2.14.12"

components: true

Update: Switched from using components: true to components: { loader: true } as mentioned previously above and that actually fixed it for me.

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

No branches or pull requests

5 participants