Skip to content
Advertisement

Nuxt.js dynamic component error “Either pre-compile the templates into render functions, or use the compiler-included build”

I’m getting the following error in Nuxt.js:

JavaScript

I was following the examples here: https://stackoverflow.com/a/39519105 and my RenderPost.vue roughly looks like this:

JavaScript

I added the <client-only> because I was also getting error about server and client not matching up. Without it, I get an additional error that says:

JavaScript

Advertisement

Answer

Nuxt normally includes the Vue runtime only (excludes the compiler) as an optimization that reduces the build size by ~10KB, as most users employ precompiled templates (e.g., via single file components). The Vue runtime-only build emits the warning you’re observing when in-DOM or string templates are used at runtime.

Since your app requires string templates at runtime, you’ll need to configure Nuxt to use the Vue build that includes the compiler:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement