vuejs

When using .vue file for my custom components it throws an vue warning.
[Vue warn]: Failed to mount component: template or render function not defined. (found in root instance)

https://vuejs.org/v2/guide/installation.html

Standalone vs. Runtime-only Build

There are two builds available, the standalone build and the runtime-only build. The difference being that the former includes the template compiler and the latter does not.

The template compiler is responsible for compiling Vue template strings into pure JavaScript render functions. If you want to use the template option, then you need the compiler.

  • The standalone build includes the compiler and supports the template option. It also relies on the presence of browser APIs so you cannot use it for server-side rendering.

  • The runtime-only build does not include the template compiler, and does not support the template option. You can only use the render option when using the runtime-only build, but it works with single-file components, because single-file components’ templates are pre-compiled into render functions during the build step. The runtime-only build is roughly 30% lighter-weight than the standalone build, weighing only 16.39kb min+gzip.

By default, the NPM package exports the runtime-only build. To use the standalone build, add the following alias to your Webpack config:

resolve: {
  alias: {
    'vue$': 'vue/dist/vue.js'
  }
}

 

posted @ 2016-11-22 15:12  alexandra  阅读(327)  评论(0编辑  收藏  举报