These are some things to be aware of when using this boilerplate.
- Special images in HTML files
- Load reducers optimistically
- Exclude modules from Babel processing
- Running tests in
- When in doubt, re-install!
- Cleaning up Jest cache
- Using short_name in Web App manifest
Special images in HTML files
If you specify your images in the
.html files using the
<img> tag, everything
will work fine. The problem comes up if you try to include images using anything
except that tag, like meta tags:
html-loader does not recognise this as an image file and will not
transfer the image to the build folder. To get webpack to transfer them, you
Then webpack will correctly transfer the image to the build folder.
Load reducers optimistically
If you have containers that should be available throughout the app, like a
NavigationBar (they aren't route specific), you need to add their respective reducers to the root reducer with the help of
Exclude modules from Babel processing
You need to exclude packages which are not intended to be processed by babel. For e.g. Server packages such as 'express' or a CSS file. Just add the package name to
exclude array in
internals/config.js and you're all set!
Running tests in
If you are unable to run tests in watch mode, you may have to install
watchman for this to work. If you're using a Mac, simply run
brew install watchman
You can also install
watchman from source. Please visit their official guide for more information.
When in doubt, re-install!
If you're facing any inexplicable problems while installing dependencies, building your project or running tests, try reinstalling dependencies. It works for most cases. Run the following commands in the exact order given:
rm -rf node_modules
npm cache clean
npm run build
Cleaning up Jest cache
By default, Jest caches transformed modules, which may lead to faulty coverage reports. To prevent this, you'll have to clear the cache by running
npm run test -- --no-cache as pointed out in Jest docs
Using short_name in Web App manifest
When there's insufficient space to display an app's full name it is truncated.
This happens with app launcher and new tab in Chrome for Android.
short_name field allows a 12 character or less abbreviation.
It also addresses any problems in testing the PWA in Lighthouse.