Jasom Dotnet
Jasom Dotnet

Reputation: 1307

Firefox add-on development: automatically reload add-on after code is changed

I'm developing Firefox add-on and problem is:

When I change code in add-on I must manually reload add-on folder in browser: 1. Go to about:debugging 2. Click on "Load temporary add-on" find add-on folder and open it

Question: Is there any way how to force Firefox to reload add-on folder on every code change? Somehow automatically?

Upvotes: 6

Views: 1833

Answers (2)

teddy-gustiaux
teddy-gustiaux

Reputation: 363

Mozilla provides a command line tool called web-ext that allows you to run your extension in Firefox and reload automatically your code when the source files are modified. The tool has many useful options that you can use to suit your needs, so I would recommend checking out the documentation page on MDN.

To get started quickly:

npm install --global web-ext
cd /path/to/your/webextension
web-ext run

Upvotes: 15

erosman
erosman

Reputation: 7721

Sadly, it is no possible. I develop the same way and had brought up the issue long time ago.

Files are Cached and not refreshed on Disable/Enable/Restart
Add Reload to installed addons in about:debugging

I have heard that it is possible with development scripts/environment but I don't use them.

Note: The background scripts (and anything that loads at start like _locales) are cached so they require restart but content scripts are not cached (well, cached per tab, you need to open a new tab).
Note that some content scripts are not cached, like addon's internal page such as pop-ups, option page etc so refreshing them will get the new version.

Upvotes: 1

Related Questions