this project permit to create a react app without Create-react-app and understand all the elements needed to make it run. The app runs thanks to react, Webpack, Babel and Typescript
Babel is our transpiler. It permit to convert ES6 JS into into backwards compatible versions of JavaScript in current and older browsers or environments.
We call babel-loader in webpack to load Babel, and then we call the presets @babel/preset-env & @babel/preset-react into the babel config file .babelrc to convert react and modern JS into compatible versions.
In order to convert css file into readable file for browser, we call :
sass-loaderto compile sass into csscss-loaderto allow css file import and css modulesstyle-loaderto inject css into the DOM
There are multiple cases to handle with assets :
html-loaderandasset/ressourceloaders permit to import a file in JScopy-webpack-pluginpermit to copy assets folder so that we can make sure that assets are in the good path when building
The production build has some optimization.
First of all, we extract css style in a single file thanks to mini-css-extract-plugin. We also minify the css in this file thanks to css-minimizer-webpack-plugin.
we also minify JS thanks to terser-webpack-plugin and html thanks to specific settings of html-webpack-plugin.