blob: f9b35f1b54ec7b4773217d07050016660b2092b4 [file] [log] [blame] [view]
avm99963ea37fdf2021-02-03 01:27:13 +01001# Build the extension
2A zip file with the contents of the extension, which can be uploaded to the
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02003Chrome Web Store and addons.mozilla.org, can be created by following these
4instructions. (make sure to [install Go](https://golang.org) before building the
5extension, as it is needed during the build).
avm99963ea37fdf2021-02-03 01:27:13 +01006
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02007The last section explains how to build the extension automatically when you
8change the source code.
avm99963ea37fdf2021-02-03 01:27:13 +01009
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020010## Build the extension as a zip file
11Run `make release` to build the extension for all the available channels and
avm99963ea37fdf2021-02-03 01:27:13 +010012browsers. You can also run `make {target}` where `{target}` is one of the
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020013following: `release_chromium_stable`, `release_chromium_beta`,
14`release_gecko_stable`.
avm99963ea37fdf2021-02-03 01:27:13 +010015
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020016Run `make clean_releases` to clean all the release files (this removes the `out`
17folder, which is where the release files are saved).
avm99963ea37fdf2021-02-03 01:27:13 +010018
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020019Take a look at `Makefile`, you'll find other targets for _make_ which do other
20interesting things (like `clean`, for instance).
21
22## Build the extension continously with webpack development mode
avm99963ea37fdf2021-02-03 01:27:13 +010023If you're developing the extension, you might want to load it into your browser
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020024without having to constantly build it manually after each change. In order to do
25that, you can run `make serve_chromium`, `make serve_chromium_mv3` or
26`make serve_gecko` depending on the type of continuous build you want.
avm99963ea37fdf2021-02-03 01:27:13 +010027
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +020028This will run webpack with watch mode and continuously serve a fresh version of
29the compiled extension at `dist/{BROWSER}`, where `{BROWSER}` depends on the
30target you selected for _make_. You can load this folder in Chrome by going to
31`chrome://extensions` and selecting "Load unpacked".
32
33Keep in mind that while the extension is continuously built, it is not
34automatically being loaded into Chrome. You'll have to reload the extension
35manually in Chrome (but at least you won't have to both build and reload it).
avm99963ea37fdf2021-02-03 01:27:13 +010036
37## About the _Chromium MV3_ target
Adrià Vilanova Martínezd4a4f3d2021-10-23 18:25:39 +020038Chromium announced a while back a
avm99963ea37fdf2021-02-03 01:27:13 +010039[new version of the manifest.json file](https://developer.chrome.com/docs/extensions/mv3/intro/),
Adrià Vilanova Martínezd4a4f3d2021-10-23 18:25:39 +020040which also introduces some changes to the extension APIs. The _Chromium MV3_
41target builds the extension using this new version.
avm99963ea37fdf2021-02-03 01:27:13 +010042
Adrià Vilanova Martínezd4a4f3d2021-10-23 18:25:39 +020043[MV2 will phase out in January 2023](https://developer.chrome.com/docs/extensions/mv3/mv2-sunset/),
44so starting with version v2.1.2, the CWS beta channel will receive the MV3
45variant of the extension to begin testing it publicly. For now, the stable
46channel will continue to receive the MV2 variant of the extension.