avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 1 | # Build the extension |
| 2 | A zip file with the contents of the extension, which can be uploaded to the |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 3 | Chrome Web Store and addons.mozilla.org, can be created by following these |
| 4 | instructions. (make sure to [install Go](https://golang.org) before building the |
| 5 | extension, as it is needed during the build). |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 6 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 7 | The last section explains how to build the extension automatically when you |
| 8 | change the source code. |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 9 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 10 | ## Build the extension as a zip file |
| 11 | Run `make release` to build the extension for all the available channels and |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 12 | browsers. You can also run `make {target}` where `{target}` is one of the |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 13 | following: `release_chromium_stable`, `release_chromium_beta`, |
| 14 | `release_gecko_stable`. |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 15 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 16 | Run `make clean_releases` to clean all the release files (this removes the `out` |
| 17 | folder, which is where the release files are saved). |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 18 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 19 | Take a look at `Makefile`, you'll find other targets for _make_ which do other |
| 20 | interesting things (like `clean`, for instance). |
| 21 | |
| 22 | ## Build the extension continously with webpack development mode |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 23 | If you're developing the extension, you might want to load it into your browser |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 24 | without having to constantly build it manually after each change. In order to do |
| 25 | that, you can run `make serve_chromium`, `make serve_chromium_mv3` or |
| 26 | `make serve_gecko` depending on the type of continuous build you want. |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 27 | |
Adrià Vilanova Martínez | 3465e77 | 2021-07-11 19:18:41 +0200 | [diff] [blame] | 28 | This will run webpack with watch mode and continuously serve a fresh version of |
| 29 | the compiled extension at `dist/{BROWSER}`, where `{BROWSER}` depends on the |
| 30 | target you selected for _make_. You can load this folder in Chrome by going to |
| 31 | `chrome://extensions` and selecting "Load unpacked". |
| 32 | |
| 33 | Keep in mind that while the extension is continuously built, it is not |
| 34 | automatically being loaded into Chrome. You'll have to reload the extension |
| 35 | manually in Chrome (but at least you won't have to both build and reload it). |
avm99963 | ea37fdf | 2021-02-03 01:27:13 +0100 | [diff] [blame] | 36 | |
| 37 | ## About the _Chromium MV3_ target |
| 38 | Chromium is working in a |
| 39 | [new version of the manifest.json file](https://developer.chrome.com/docs/extensions/mv3/intro/), |
| 40 | which also introduces some changes to the extension APIs. Eventually, all Chrome |
| 41 | extensions will be required to have migrated to Manifest V3 (MV3), so in order |
| 42 | to anticipate this change, a new experimental _Chromium MV3_ target has been |
| 43 | added. |
| 44 | |
| 45 | This target is experimental in the sense that it isn't actually used when |
| 46 | building the extension ZIPs which are uploaded to the Chrome Web Store (MV2 is |
| 47 | still used), and because these builds aren't currently being exhaustively |
| 48 | tested. |