Skip to content

1.6.0 - No more errors

Latest
Compare
Choose a tag to compare
@reorx reorx released this 04 Jan 08:07
· 11 commits to master since this release

To all who are concerned about this project, I have updated @reorx/webpack-ext-reloader to version 1.6.0, which addresses a persistent issue where the plugin continually raised errors, significantly disrupting the development experience. The errors in question were primarily the following:

  1. Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.: This error occurred when the plugin's code attempted to send a message to a tab that did not have a message listener. It has been resolved by adding a .catch statement after the .sendMessage call.
  2. WebSocket is already in CLOSING or CLOSED state: This error commonly appeared after the extension reloaded, when trying to send reload results to a server that was either down or when the socket instance had become outdated. This has been corrected by adding a state check before invoking socket.send.
  3. Websocket HTTP Authentication failed; no valid credentials available: This error surfaced if the webpack process was terminated, as the plugin would then repeatedly attempt to reconnect to the server. It was challenging due to its origin in the 'new WebSocket', which made it impossible to prevent the error from displaying in the console. The fix involved implementing an HTTP server on the same port and using a fetch request to this server as a reconnect attempt.

Overall, @reorx/webpack-ext-reloader is now more robust against errors. You can confidently assume that any errors appearing in chrome://extensions are worth investigating without having to manually clear them out repeatedly.

Additional quality-of-life improvements include:

  • A clear distinction between changes made to the background, content scripts, and extension pages, ensuring that only the relevant tabs are refreshed. For example, the extension itself will not reload unless changes are made to the background, and side panels remain open after making non-background updates.
  • To prevent Chrome from terminating an inactive service worker, content scripts and extension pages now send periodic ping/pong messages to the background. This replaces the previous workaround of having to keep the developer tools open for the background page to keep it alive. Therefore, if your extension has any content scripts or extension pages running, it will automatically reload without needing to keep the developer tools open.