nesterone / vue-vega

Vega Lite and Vega bridge to Vue.js ecosystem
https://nesterone.github.io/vue-vega
MIT License
67 stars 15 forks source link

[Vue warn]: You are using the runtime-only build of Vue #52

Open peteruithoven opened 4 years ago

peteruithoven commented 4 years ago

I've started a new project using the Vue cli, but when I install vue-vega and add a simple example I get this error:

[Vue warn]: 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.

Is there anything I can do? Maybe some additional Getting started step would be good?

I'd love to combine vue-vega with VuePress where you normally compile as much as possible beforehand.

peteruithoven commented 4 years ago

This might be related to: https://github.com/nesterone/vue-vega/issues/33 ?

peteruithoven commented 4 years ago
// HelloWorld.vue
<template>
  <vega-lite :data="values" mark="bar" :encoding="encoding" />
</template>

<script>
import Vue from "vue";
import VueVega from "vue-vega";

Vue.use(VueVega);

export default {
  name: "HelloWorld",
  props: {
    msg: String
  },
  data() {
    return {
      values: [
        { a: "A", b: 28 },
        { a: "B", b: 55 },
        { a: "C", b: 43 },
        { a: "D", b: 91 },
        { a: "E", b: 81 },
        { a: "F", b: 53 },
        { a: "G", b: 19 },
        { a: "H", b: 87 },
        { a: "I", b: 52 }
      ],
      encoding: {
        x: { field: "a", type: "ordinal" },
        y: { field: "b", type: "quantitative" }
      }
    };
  }
};
</script>
peteruithoven commented 4 years ago

Including the compiler of course fixes it

// vue.config.js
module.exports = {
  runtimeCompiler: true
};

Reference: https://cli.vuejs.org/config/#runtimecompiler More info: https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only

How to do this for VuePress: https://github.com/vuejs/vuepress/issues/402#issuecomment-388169056

bschimoler commented 3 years ago

Is this an issue with how vue-vega is packaged? Is there a way to update this library to avoid needing to add this to projects using this lib?