- Chrome Extension Manifest V3
- React 17
- Webpack 5
- Webpack Dev Server 4
- React Hot Loader
- eslint-config-react-app
- Prettier
- TypeScript
- Check if your Node.js version is >= 14.
- Clone this repository.
- Run
yarn install
to install the dependencies. - Run
yarn start
oryarn build
- Load your extension on Chrome following:
- Access
chrome://extensions/
- Check
Developer mode
- Click on
Load unpacked extension
- Select the
build
folder.
- Access
- Happy hacking.
All your extension's code must be placed in the src
folder.
The project implements a popup, an options page, a background page, and a new tab page (which replaces the new tab page of your browser).
This project supports TypeScript! The Options
Page is implemented using TypeScript. Please refer to src/pages/Options/
for example usages.
To make your workflow much more efficient this project uses the webpack server to development (started with yarn start
) with auto reload feature that reloads the browser automatically every time that you save some file in your editor.
This project uses @types/chrome for auto completetion.
PORT=4000 yarn run start
After the development of the extension run the command
$ NODE_ENV=production yarn build
Now, the content of build
folder will be the extension ready to be submitted to the Chrome Web Store. Just take a look at the official guide to more infos about publishing.
If secrets are needed, create ./secrets.<env>.js
, and import the file ./secrets.<THE-NODE_ENV>.js
to modules through the module named as secrets
. For example, the compilation process will emit secrets js, as it placed in '_./src/secrets.development.js`
export default { key: '123' };
./src/popup.js
import secrets from 'secrets';
ApiCall({ key: secrets.key });
👉 The files with name secrets.*.js
already are ignored on the repository.
Gassa Yan