Vue-loader

Posted zhaodz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Vue-loader相关的知识,希望对你有一定的参考价值。

1.安装

npm install -D vue-loader vue-template-compiler

2.配置webpack.config.js

const VueLoaderPlugin = require(vue-loader/lib/plugin)

module.exports = {
  module: {
    rules: [
      // ... other rules
      {
        test: /.vue$/,
        loader: vue-loader
      }
    ]
  },
  plugins: [
    // make sure to include the plugin!
    new VueLoaderPlugin()
  ]
}

3.main.js文件

import Vue from vue
import App from ./App.vue

var vm = new Vue({
el: #app,
render:f=>f(App),
// template:‘<App/>‘,
// components:{
//     App
// }
})

 

以上是关于Vue-loader的主要内容,如果未能解决你的问题,请参考以下文章