VUE2 本地启动https服务
1. 安装Chocolatey
先安装choco,使用choco安装mkcert
在 powerShell 管理员模式命令行输入
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
把这两个文件放到项目中
vue.config.js 中添加
const fs = require("fs")
module.exports = {
devServer: {
https: true,
key: fs.readFileSync('src/ssl/local.test.tech-key.pem'),
cert: fs.readFileSync('src/ssl/local.test.tech.pem'),
}
}