Starter kit for React projects: webpack 4, React 16, React Hot Loader 4, Browsersync, ESLint, Mocha, CSS Modules, stylelint, and more.
Update most of the dependencies to the latest versions. Major version changes are as follows:
connected-react-router 4.5.0 -> 6.2.1
react-redux 5.0.7 -> 6.0.0
reselect 3.0.1 -> 4.0.0
css-loader 1.0.0 -> 2.1.0
file-loader 2.0.0 -> 3.0.1
jsdom 11.11.0 -> 13.1.0
sinon 6.3.4 -> 7.2.2
lint-staged 7.3.0 -> 8.1.0
react-hot-loader 4.3.11 -> 4.6.3 (not major, but API is changed)
Change related files according to updated packages' API changes
Change folder structure (add some currently empty folders for future example project)
Change eslint config
Change css-loader setup
Add mocha-webpack
package and use it's config instead of plain mocha
test setup for unit testing:
JSDOM
setup into separate file tools/jsdomSetup.js
webpack
config for unit testingwebpack-node-externals
package and externals
option to webpack
test config so webpack don't bundle packages from node_modules
and just require them instead that improves test build speedtools/testSetup.js
script to do the following things:
tools/jsdomSetup.js
scriptchai
, sinon
, enzyme
, etc.)chai
with sinonChai
, etc.)expect
, sinon
, shallow
, mount
, and render
variables to global scope, so they can be used in all test files without requiring themmocha-webpack
to use webpack
test config and run tools/testSetup.js
script before unit tests executionchai-as-promised
package and extend chai
wit it to help testing async codecheerio
package to prevent peer dependency warnings from yarn
and npm
Add and configure nyc
and istanbul-instrumenter-loader
to set up unit test coverage.
mode
option to webpack
config (that is required when using webpack 4
).optimization
options that internally call those plugins:
NoEmitOnErrorsPlugin -> optimization.noEmitOnErrors
uglifyjs-webpack-plugin
as separate package and use it in optimization.minimazer
instead of plugins
as webpack 4 docs suggest.optimize-css-assets-webpack-plugin
(that uses cssnano
internally) to minimize CSS in production mode. Comparing to using css-nano
as PostCSS
plugin with post-css-loader
it minifies the whole bundle(s) instead of separate chunks which could be potentially faster and with a smaller result.mini-css-extract-plugin
instead of extract-text-webpack-plugin
. (why?)splitChunks
optimization
option to automatically extract 3rd party modules to separate vendor
bundle (in production mode). Get rid of using legacy CommonsChunkPlugin
to extract runtime chunk and configure runtimeChunk
optimization
option instead.HashedModuleIdsPlugin
from production config.webpack-bundle-analyzer
to not automatically open report page in default browser when project is built.build
script to not start production server automatically when project is built.connect-history-api-fallback
package and use single: true
config option of browser-sync
package instead.husky
(instead of pre-commit
) and lint-staged
packages.redux-devtools-extension
package to connect redux store with Chrome
Redux DevTools
extension.react-router-redux
with connected-react-router
because of former is deprecated.enzyme-adapter-react-16
package as new version of enzyme
requires it.recompose
and reselect
packages.react-addons-test-utils
package.svg-url-loader
package.config
folder structure.eslint
config accordingly.Add CSS Modules support. Edit css-loader package description.
Add basic assets pipeline:
Add description to README for following packages:
Initial working implementation: