Farshad Fahimi
Farshad Fahimi

Reputation: 648

use dynamic component in the nuxt layout get runtime compile error

in my nuxt application. in layout file use dynamic component for set the component in different pages like below

<template>
  <div id="app">
    <div id="app-body">
      <div id="app-topbar">
         <component v-bind:is="actionBar.component"></component>
      </div>

      <div id="app-content">
        <nuxt />
      </div>
    </div>
  </div>
</template>

but when I'm runing the application I got the error in below

You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

I'll try to wrap my component in no-ssr tags but the error still exist

Upvotes: 1

Views: 597

Answers (1)

Christoph Dietrich
Christoph Dietrich

Reputation: 537

as DigitalDrifter already said, you need to use the compiler-included build.

To do that in nuxt try to add the following to your nuxt.config.js:

build: {
  extend(config, ctx) {
    config.resolve.alias['vue'] = 'vue/dist/vue.common'

Upvotes: 1

Related Questions