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 // } })
原文:https://www.cnblogs.com/zhaodz/p/11715157.html