The current Rekit boilerplate has been working well for a long time, but compared to create-react-app, actually there isn’t essential difference on the project configurations like Webpack, Babel, ESLint, etc. When many people are asking about how to config Rekit app in a create-react-app way, we just came up with idea why not build Rekit application based on create-react-app? Then people don’t need to learn a new boilerplate and could also use Rekit Studio to develop apps created by awesome create-react-app.
We’ve just released Rekit 2.3.0 which creates apps default by create-react-app. All you need to do is to install/update your global rekit command:
npm install -g rekit
Then any apps created will be based on create-react-app:
rekit create my-cra-app [--sass]
There is still
--sass argument to use sass instead of less as the css preprocessor. The
--clean argument is removed because now examples code is grouped in a separate feature. You can easily remove it by one click with Rekit Studio.
Compared to create-react-app
Based on create-react-app, Rekit adds below libraries to the stack so that Rekit apps just keep the same as before:
- Redux: state management
- React Router: routing library
- Sass/Less: CSS preprocess
- Axios: it’s our favorite HTTP client.
- React hot loader: hot load without refresh
- Enzyme: React unit tests
- Nock: HTTP mocking and expectations library
Besides those added libraries, Rekit also creates an opinionated folder structure to organize files so that the project could be managed by Rekit and is easy to scale.
Compared to previous Rekit apps
1. Moved to Jest for Unit Testing
The major difference compared to previous Rekit apps is now we are using Jest , set up by create-react-app, for unit tests while we used Mocha before. Now all tests created by Rekit are based on Jest. However, the tests pattern is very like Mocha, and still uses Enzyme for React tests, so you should not feel big difference when writing tests.
2. Webpack DLL Plugin is Removed
In the previous Rekit app we used Webpack DLL plugin to accelerate build speed at dev time. Now it’s removed in favor of https://github.com/facebook/create-react-app/issues/3878 . Though still not finished, we will integrate it at the first time when it’s done.
3. Internal Build Server is Removed
To test the build result, Rekit started a static express server. Now it’s removed as we follow the convention of create-react-app, use
serve npm module to start a static server for verifying if necessary. There is a good tip for it after run
npm run build.
4. Airbnb ESLint rules is removed
Having to say airbnb eslint rules are too strict for some projects. Now it just keeps the one create-react-app uses.
The basic boilerplate of Rekit apps has been bootstrapped by create-react-app, but all functionalities of Rekit just keep the same as before. While you could still use Rekit Studio to create React apps with happiness, you could also benefit from the ecosystem of create-react-app, and it would be easy to learn many HOW-TOs from create-react-app’s perfect documentation.