Vue报 the template compiler is not available

When using antv's X6 vue-shape component, a warning error is reported: 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.

reason:

During project configuration, the default npm package exports the runtime build, that is, the runtime version, and does not support compiling templates.

When vue initializes the project configuration, there are two versions of the running environment configuration: the Compiler version and the Runtime version.

The main differences are:

    1. Compiler version:

         The template template content can be compiled (including string templates and html objects that can be bound as templates), for example:

new Vue({
  el: "#x6",
  template: "<div>{
   
   {msg}}</div>",
  data: {
    msg: "x6"
  }
});

    2. Runtime version:

          When using vue-loader to load .vue files (component files), webpack renders the template during the packaging process.

Solution:

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

 

Guess you like

Origin blog.csdn.net/saperliu/article/details/111474033