Component provided template option but runtime compilation is not supported in this build of Vue
I'm getting this runtime error in the browser when I run Storybook. The error specifically only happens for this story:
This is my
./storybook/main.ts
:
The full error in browser:
1 Reply
have you tried aliasing it like it recommends?
The warning you're encountering occurs because Vue's runtime-only build is being used, which does not support templates in components. The runtime-only build is lighter and faster but requires that your templates are pre-compiled during the build step, often using tools like Vue Loader in a Webpack setup or Vite.
To resolve this, you need to configure your bundler (Webpack, Vite, etc.) to use the build of Vue that includes the template compiler. This can be done by aliasing Vue to
vue/dist/vue.esm-bundler.js
. Here’s how you can do it depending on the bundler you’re using:
For Webpack:
If you're using Webpack, you can add an alias in your Webpack configuration file (webpack.config.js
):
For Vite:
If you're using Vite, you can add the alias in your Vite configuration file (vite.config.js
):
For Nuxt 3:
If you're using Nuxt 3, this issue usually doesn't arise because Nuxt handles these configurations internally. However, if it does, you might need to look into custom build configurations in your nuxt.config.js
.
After adding this alias, your bundler will use the correct Vue build that includes the template compiler, and the warning should be resolved.
wow, chatgpt can answer all your questions