Caio Alonso

Personal React App Starter for Babel 7, Webpack 4

Here’s a personal record of the steps I take to start a React app from zero, understanding what every single dependency does.

If you just want a clean React starting point, clone the repository:

git clone

Start here:

mkdir projectname
cd projectname
mkdir src
touch src/index.html
touch src/index.js
npm init -y

Now the dependencies:

npm add --save-dev webpack webpack-cli html-webpack-plugin html-loader webpack-dev-server \
@babel/core babel-loader @babel/preset-env @babel/preset-react \
react react-dom \

Scripts in package.json:

"scripts": {
	"start": "webpack-dev-server --open --mode development",
    "build": "webpack --mode production",

Import the presets in .babelrc:

  "presets": [

Import the loaders and plugins in webpack.config.js:

const HtmlWebPackPlugin = require("html-webpack-plugin");

module.exports = {
  module: {
    rules: [
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader"
        test: /\.html$/,
        use: [
            loader: "html-loader"
  plugins: [
    new HtmlWebPackPlugin({
      template: "./src/index.html",
      filename: "./index.html"

Now edit src/index.html and src/index.js however you’d like, run npm start to start the dev server, run npm run build to compile it all into dist.

27 Nov 2018