There’s a create-react-app script claimed to help manage all the React dependencies and requirements, but as any black box it is good just till the moment you have to understand its internals.

For sake of never facing this risk we in S4Y never used it in our projects. Instead i prefer to spent ~30 minutes to read webpack news and ~1 hour to create the react-mobx project from the components i know that they are for bundled in the predictable way.

But what about the support? What happened if another person or team would need to manage the code?

My belief it is much easier for a clever developer to get in with the clean, relative short code than trying to understand tons of docs of “standard tools”.

So, the first step is to create package.json and fulfil it with the dependencies. Pay attention i use html-webpack-plugin in order to use my own html (ejs in fact) template as a global wrapper for react scripts instead of letting webpack to produce magic. It adds about 15 minutes (if you know that to do) to the initiating project but give you a freedom of code management for the rest of the project.

Now webpack config to create the bundles for the essential tasks: development, productions, stat.

Configure babel with .babelrc in order to have ES6 syntax compiled:

and finally complete the project setting by adding the tasks to the scripts section of the package.json

That’s all. Now we can start coding react app itself.

Most probably nobody will use the configs above “as is” but what i wanted to show is there’s nothing too difficult to live without huge pile of codebase from “create-react-app”.

Categories: Development

Leave a Reply

Your email address will not be published. Required fields are marked *