A simple React Application template which routes to different pages on user interaction, made from scratch using Babel, Webpack, React Router.
- webpack 4
- babel 7 transforming JSX and ES6, ES7, ES8
- react
16.13.1
- react-router
5.1.2
- lodash
- eslint with airbnb config.
- prettier Prettier is an opinionated code formatter.
- style & css-Loader & sass-loader
- postcss
- react-css-modules Transforms styleName to className using compile time CSS module resolution.
- stylelint with standard config.
- browserslist Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env.
- react-hot-loader Tweak React components in real time.
- webpack-dev-serve Serves a webpack app. Updates the browser on changes.
- Jest with Enzyme for testing.
- lint-staged Precommit hooks via lint-staged + Husky.
- commitlint Lint commit messages.
- webpack-bundle-analyzer Visualize size of webpack output files with an interactive zoomable treemap.
-
Clone the template repo.
git clone https://github.com/xinpuchen/react-template.git
-
npm i
to install npm packages. -
Use
npm run build:dll
to build dlls. -
Start dev server using
npm run dev
. -
Build and bundling your resources for production
npm run build
. -
Lint your code using
npm run lint
. -
Use
npm run build --report
Starts webpack-bundle-analyzer to give you the opportunity to analyze your bundles.
npm run dev
– starts development server with webpack-dev-server.npm run build
– builds project to production.npm run lint
– lints both JavaScript (withnpm run lint:js
) and Sass files (withnpm run lint:scss
).npm test
– runs tests with Jest.