vite-plugin-wss-hmr 0.4.12 → 0.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs +3 -3
  2. package/index.js +3 -3
  3. package/package.json +1 -1
package/index.cjs CHANGED
@@ -68,7 +68,7 @@ async function createVitePlugin() {
68
68
  }
69
69
  },
70
70
  buildStart() {
71
- if (hmrServer.ws) {
71
+ if (hmrServer?.ws) {
72
72
  const { base = '' } = hmrServiceConfig;
73
73
  const { host, port } = hmrServiceConfig.server?.hmr;
74
74
  console.log(`[vite-plugin-wss-hmr] hmrServer working on wss://${host}:${port}${base}`);
@@ -95,7 +95,7 @@ async function createVitePlugin() {
95
95
  if (updates.length > 0) {
96
96
  console.log(`[vite-plugin-wss-hmr] hot reloading: ${updateFileUrlList.join(' ')} updates`);
97
97
 
98
- hmrServer.ws.send({
98
+ hmrServer?.ws.send({
99
99
  type: 'update',
100
100
  updates,
101
101
  });
@@ -110,7 +110,7 @@ async function createVitePlugin() {
110
110
  clearInterval(pongPoll);
111
111
  }
112
112
  if (hmrServer) {
113
- hmrServer.close();
113
+ hmrServer?.close();
114
114
  }
115
115
  },
116
116
  };
package/index.js CHANGED
@@ -66,7 +66,7 @@ async function createVitePlugin() {
66
66
  }
67
67
  },
68
68
  buildStart() {
69
- if (hmrServer.ws) {
69
+ if (hmrServer?.ws) {
70
70
  const { base = '' } = hmrServiceConfig;
71
71
  const { host, port } = hmrServiceConfig.server?.hmr;
72
72
  console.log(`[vite-plugin-wss-hmr] hmrServer working on wss://${host}:${port}${base}`);
@@ -93,7 +93,7 @@ async function createVitePlugin() {
93
93
  if (updates.length > 0) {
94
94
  console.log(`[vite-plugin-wss-hmr] hot reloading: ${updateFileUrlList.join(' ')} updates`);
95
95
 
96
- hmrServer.ws.send({
96
+ hmrServer?.ws.send({
97
97
  type: 'update',
98
98
  updates,
99
99
  });
@@ -108,7 +108,7 @@ async function createVitePlugin() {
108
108
  clearInterval(pongPoll);
109
109
  }
110
110
  if (hmrServer) {
111
- hmrServer.close();
111
+ hmrServer?.close();
112
112
  }
113
113
  },
114
114
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-wss-hmr",
3
3
  "type": "module",
4
- "version": "0.4.12",
4
+ "version": "0.4.15",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "exports": {