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

2

5

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?

Gimble answered 23/6, 2019 at 12:5 Comment(0)
H
14

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
Habit answered 3/8, 2019 at 0:37 Comment(0)
J
1

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.

Jacklyn answered 24/6, 2019 at 4:26 Comment(2)
Thank you for an information and development trick (cached per tab, you need to open a new tab). I will leave the question open so maybe somebody found better way how to do a thing.Gimble
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.Jacklyn

© 2022 - 2024 — McMap. All rights reserved.