Vue-loader

1.安裝vue

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

2.配置webpack.config.jswebpack

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文件web

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

var vm = new Vue({
el: '#app',
render:f=>f(App),
// template:'<App/>',
// components:{
//     App
// }
})
本站公眾號
   歡迎關注本站公眾號,獲取更多信息