优化hmr
parent
b841475b63
commit
c9bdc6c2f3
|
@ -16,13 +16,17 @@ export const COMMON_HEADERS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const HMR_SCRIPT = `
|
export const HMR_SCRIPT = `
|
||||||
!(function(){
|
!(function vue_live_hmr(){
|
||||||
var ws = new WebSocket(\`ws\${location.protocol === 'https:' ? 's' : ''}://\${location.host}/ws-vue-live\`)
|
var ws = new WebSocket(\`ws\${location.protocol === 'https:' ? 's' : ''}://\${location.host}/ws-vue-live\`)
|
||||||
|
|
||||||
ws.addEventListener('open', function (r) {
|
ws.addEventListener('open', function (r) {
|
||||||
console.log('vue-live hmr ready...')
|
console.log('vue-live hmr ready...')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ws.addEventListener('close', function(){
|
||||||
|
setTimeout(vue_live_hmr, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
ws.addEventListener('message', function (ev) {
|
ws.addEventListener('message', function (ev) {
|
||||||
var { action, data } = JSON.parse(ev.data)
|
var { action, data } = JSON.parse(ev.data)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@bytedo/vue-live",
|
"name": "@bytedo/vue-live",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"bin": {
|
"bin": {
|
||||||
"vue-live": "index.js"
|
"vue-live": "index.js"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue