cnpm i vue vue-loader vue-template-compiler -S
// webpack.config.jsconst {VueLoaderPlugin} = require("vue-loader")module.exports = { module:{ rules:[ ... { test:/\.vue$/, loader:'vue-loader' } ] }, plugins:[ new VueLoaderPlugin() ]}
// index.html<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <div id="app"></div></body></html>
//main.jsimport './assets/index.css'import App from './App.vue';import Vue from 'vue';new Vue({ render:h=>h(App)}).$mount("#app");
npm run build //将项目打包,打包之后的项目就可以上传服务器了npm run serve/yarn serve //查看项目的运行效果