3 ms·
This is neat. How does live-reloading work? Manually reloading a chrome extension with each code change has been a pain point for me in the past.
by cfu28 4y ago
This is neat. How does live-reloading work? Manually reloading a chrome extension with each code change has been a pain point for me in the past.
- coldsauce 4y agoThanks! We wrote a custom Parcel runtime [1] inspired by Parcel's HMR runtime (which was too bloated and buggy for us) that injects a web socket listener into the development build of the extension. Whenever a bundle change happens, Parcel sends it the refresh message and it either does `chrome.runtime.reload()` or `location.reload()` depending on the context. [1]: https://github.com/PlasmoHQ/plasmo/blob/main/packages/parcel-runtime/loaders/hmr-runtime.js#L34 https://github.com/PlasmoHQ/plasmo/blob/main/packages/parcel...