chrome-extension-boilerplate icon indicating copy to clipboard operation
chrome-extension-boilerplate copied to clipboard

add hot-reload

Open sss63232 opened this issue 5 years ago • 2 comments

Hi,

Thanks for your work. It's pretty nice!

Have you ever thought about adding 'hot-reload' into the function. It would make it much easier to develop and debug.

sss63232 avatar Jan 20 '19 01:01 sss63232

Here are two possibilities:

  1. Use Extensions Reloader.
  2. Import hot-reload.js in your background entry script and develop with webpack --watch.

ghost avatar Jun 22 '19 12:06 ghost

Thanks for the suggestion, @sss63232!

I haven't played much with hot reload solutions, but if you load your extension with "load unpacked", Chrome will continue to refer to extension components in their original location on disk. This means that if you have, for example, a popup.html, you can run npx webpack and the new popup will be displayed next time you click the extension icon. No need to reload the extension.

This doesn't work with background scripts, however, since they're long-running. You can reload those by using "load unpacked" again, or simply toggling the extension off and on. It looks like the above solutions would work as well.

Please let me know if you find a solution that works well for you. We would definitely be open to a pull request adding this functionality!

nickmooney avatar Jun 24 '19 18:06 nickmooney