A good starting point for using webpack to build stuffs.
Tested on both Windows and macOS, with:
Node
= 16.15.1
Yarn
= 3.2.4
webpack.config.js
and update the configuration field entry
to determine what to be built;utils/env.js
and update the configuration field NOT_HOT_RELOAD
to determine which entries to be excluded from Hot Module Replacement (HMR);CONTENT_SCRIPT
and BACKGROUND
to match the entries of Content Scripts and Background respectively.# Install dependencies
yarn install
# Start dev server
yarn run start
# Build application
yarn run build
# Commit
yarn commit
# Release
yarn release
To use Hot Module Replacement, please place components outside the top-level file. Components in the top-level file will be downgraded to live reload.
Remember to keep the DevTool panel of the Background service worker open during development, otherwise Auto-Reload may not work as expected.
See here for more details.
CSS's naming convention requires the class names to be in kebab-case
. However, in JavaScrip, it is not allowed to write style.my-style
and only accepts style['my-style']
or style.myStyle
. It is not convenient. Therefore, in this boilerplate, the class names in css-modules will be converted from kebab-case
to camelCase
to allow usages such as style.myStyle
.