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-content build error when class prop is an object #222

Closed
olibia opened this issue Jul 3, 2020 · 0 comments · Fixed by #223
Closed

nuxt-content build error when class prop is an object #222

olibia opened this issue Jul 3, 2020 · 0 comments · Fixed by #223
Assignees
Labels
bug Something isn't working

Comments

@olibia
Copy link

olibia commented Jul 3, 2020

Version

@nuxt/content: v1.4.1
nuxt: v2.13.3

Steps to reproduce

Add an object as class property to nuxt-content component.

<nuxt-content :class="{ myClass: true }">

Run yarn build && yarn export.

What is Expected?

The project to build successfully and the component to be displayed.

What is actually happening?

Build error when mode is universal.

TypeError: (data.class || []).concat is not a function
    at render (.nuxt/content/nuxt-content.js:127:0)
    at /home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:22507
    at Ie (/home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:22689)
    at /home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:23819
    at Le (/home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:24170)
    at e._c (/home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:32380)
    at a.render (pages/posts/_id.vue?7336:1:0)
    at a.t._render (/home/olibia/Projects/Statica/baba-au-rum/node_modules/vue/dist/vue.runtime.common.prod.js:6:35273)
    at /home/olibia/Projects/Statica/baba-au-rum/node_modules/vue-server-renderer/build.prod.js:1:70665
    at runNextTicks (internal/process/task_queues.js:62:5)
    at listOnTimeout (internal/timers.js:518:9)
    at processTimers (internal/timers.js:492:7)

Client error when mode is spa.

TypeError: (intermediate value).concat is not a function

Notes

This does not happen on development.

The error occurs because of this line:

data.class = (data.class || []).concat('nuxt-content')

It expects classes to be an Array.

@olibia olibia added the bug Something isn't working label Jul 3, 2020
@benjamincanac benjamincanac self-assigned this Jul 3, 2020
@benjamincanac benjamincanac linked a pull request Jul 3, 2020 that will close this issue
3 tasks
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

Successfully merging a pull request may close this issue.

2 participants