There are two kinds of entryfiles.
- All js-files in the root of the
./app/scripts
directory - All css-,scss- and less-files in the root of the
./app/styles
directory
The main logic is in /app/scripts/background.js
, /app/scripts/contentscript.js
and app/scripts/worker.js
.
- Use yarn or npm to add the dependency. e.g,.
$ yarn add underscore
- Import the library where needed. e.g.,
import _ from 'underscore'
- Install node.
- Use yarn (preferred):
$ yarn install
or npm:$ npm install
- Build the extension
- Production:
- Chrome: Run
$ yarn run build chrome
- Firefox: Run
$ yarn run build firefox
- Opera: Run
$ yarn run build opera
- Edge: Run
$ yarn run build edge
- Chrome: Run
- Development:
- Chrome: Run
$ yarn run dev chrome
- Firefox: Run
$ yarn run dev firefox
- Opera: Run
$ yarn run dev opera
- Edge: Run
$ yarn run dev edge
- Chrome: Run
- Load the extension:
- Chrome:
- Load
dist/chrome
directory using Load Unpacked.
- Load
- Firefox:
- Enter "about:debugging" in the URL bar
- Click "Load Temporary Add-on"
- Load
dist/firefox/manifest.json
The build tool also defines a variable named process.env.NODE_ENV
in your scripts.