rubenspgcavalcante/webpack-chrome-extension-reloader

How to prevent popup tab from closing?

OriginalEXE opened this issue · 6 comments

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Ubuntu 18.04
  • Library Version: 1.1.1

I'm going to open a PR:

  • yes
  • no

Description:
Hello!

First of all, thank you for maintaining this useful library. I have one issue that prevents me from using it, and I wanted to check whether it is possible to accommodate my use case.

When I am developing a view inside the popup, I like having it always visible (instead of having to click on the icon to show it each time). I do that by inspecting the network request of the popup, and simply opening the main one in the new tab. It works great. The problem is, once I use your library, once a change is performed the popup tab closes, and then I have to open it again. Ideally, it would just refresh.

Do you think this is doable? I believe it would be useful to many, but maybe I am wrong and there is a better way to develop popup views, in which case, please educate me :)

Thanks,
Ante

Hi @OriginalEXE ,
You can avoid page reloading by passing the plugin option reloadPage as false.
I don't know if this helps out, but probably will do.
In any case I would like to hear your feedback if it worked :)

Hey @rubenspgcavalcante

Than's for getting back to me. I have already tried setting the option to false before reaching out, but I saw no difference in the behavior unfortunately.

Ok, so much probably is the runtime reload of the plugin causes chrome to remove the resource to replace it again.
Ok so probably I should trigger it only when one of the content-scripts or the background had changed, in other cases just let webpack replace the resources.
This way you'll probably need to reload manually the Popup tab, as you open it through the network panel, but at least it will not be closing anymore 🤔
I'll try to reserve some time to analyse what can be done and the best way to not cause confusion to the other plugin users.

Thanks a lot. I am totally fine with reloading it manually, that's what I am doing without the plugin anyways, but I do want to take advantage of other benefits of this library, so just having the popup not close would be awesome.

Thanks a lot. I am totally fine with reloading it manually, that's what I am doing without the plugin anyways, but I do want to take advantage of other benefits of this library, so just having the popup not close would be awesome.

any updates here?

Sorry, took a long vacation and was only able to work on this now.
Now the plugin is taking a more smart strategy, only reloads the chrome extension when is necessary, when content or background scripts (or anything in their dependency tree) are emitted by webpack.

This makes the popup maintain itself open after webpack emits any other files or entries then content or background entries. This changes are available on the version 1.3.0

Hope this sounds good :)