2020
10-09
10-09
vue-cli打包后本地运行dist文件中的index.html操作
使用npmrunbuild生成dist文件夹中的文件是你需要上传到服务器上的文件,直接打开index.html会直接报错可以尝试用express搭建一个服务器,做法如下:1、在dist根目录下新建server.js文件;2、代码如下:varexpress=require('express');varapp=express();consthostname='localhost';constport=3000;app.use(express.static('./'));app.listen(port,hostname,()=>{console.log(·Serverrunningathttp://${host...
继续阅读 >