webpack-dev-server运行时在控制台打印二维码
$ npm install @ice-point/webpack-server-qrcode
const WebpackServerQRcode = require('@ice-point/webpack-server-qrcode')
module.exports = {
devServer: {
...
host: '0.0.0.0'
},
plugins: [
new WebpackServerQRcode()
]
}
确保电脑和手机处于同一个局域网内,手机扫码即可预览,手机端支持实时刷新。