Vue-loader

纵饮孤独 提交于 2019-12-01 19:43:21

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
// }
})

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!