Rails + webpacker + vue: "You are using the runtime-only build of Vue where the template compiler is not available."
The default export for the vue NPM package is the runtime only.
As you need the template compiler, you need to change your Vue import to the following, which includes both the runtime and the template compiler:
import Vue from 'vue/dist/vue.esm.js';
More details: here https://vuejs.org/v2/guide/installation.html#Explanation-of-Different-Builds
You can also define an alias to the vue esm build in config/webpack/environment.js
file:
const { environment } = require('@rails/webpacker');const vue = require('./loaders/vue');environment.loaders.append('vue', vue);environment.config.resolve.alias = { 'vue$': 'vue/dist/vue.esm.js' }; // <- add aliasmodule.exports = environment
And then you will be able to import vue
like this:
import Vue from 'vue'