优化hmr

pull/1/head
yutent 2023-02-12 17:04:19 +08:00
parent b841475b63
commit c9bdc6c2f3
2 changed files with 6 additions and 2 deletions

View File

@ -16,12 +16,16 @@ export const COMMON_HEADERS = {
}
export const HMR_SCRIPT = `
!(function(){
!(function vue_live_hmr(){
var ws = new WebSocket(\`ws\${location.protocol === 'https:' ? 's' : ''}://\${location.host}/ws-vue-live\`)
ws.addEventListener('open', function (r) {
console.log('vue-live hmr ready...')
})
ws.addEventListener('close', function(){
setTimeout(vue_live_hmr, 1000)
})
ws.addEventListener('message', function (ev) {
var { action, data } = JSON.parse(ev.data)

View File

@ -1,7 +1,7 @@
{
"name": "@bytedo/vue-live",
"type": "module",
"version": "0.1.5",
"version": "0.1.6",
"bin": {
"vue-live": "index.js"
},