问题遇到的现象和发生背景
需求:app嵌入型h5项目,实现二维码扫描功能。
在网上找了几个案例,但都是需要在https下才能正常运行。
问题就是项目中配置的https无效,不清楚到底应该如何配置
用代码块功能插入代码,请勿粘贴截图
"webpack": "^3.6.0", 使用的webpack版本
config/index.js文件,这是配置项
module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
// host: 'localhost', // can be overwritten by process.env.HOST
host:'192.168.1.84',
// host: '127.0.0.1',
port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
https: true,
devtool: 'cheap-module-eval-source-map',
cacheBusting: true,
cssSourceMap: true,
proxyTable: {
'/test': {
target: 'https://api',
changeOrigin: true,
secure:false,
pathRewrite: {
'^/test': ''
},
ws:false //
},
},
},
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
},
}
我的解答思路和尝试过的方法
我看别人的都是在 devServer 中配置的,我在另外一个vue-cli项目中试了一下,也可以,但是我这个项目是webpack创建的vue项目,在dev中配置https就无效了。
我想要达到的结果
使本地项目能够在 https 上运行