The Complete Guide for Setting Up React App from Scratch (feat. TypeScript)

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • webpack

    A bundler for javascript and friends. Packs many modules into a few bundled assets. Code Splitting allows for loading parts of the application on demand. Through "loaders", modules can be CommonJs, AMD, ES6 modules, CSS, Images, JSON, Coffeescript, LESS, ... and your custom stuff.

  • import path from 'path'; import webpack from 'webpack'; import HTMLWebpackPlugin from 'html-webpack-plugin'; //create css file per js file: https://webpack.kr/plugins/mini-css-extract-plugin/ import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; const isDevelopment = process.env.NODE_ENV !== 'production'; // define plugins const plugins: webpack.WebpackPluginInstance[] = [ new HTMLWebpackPlugin({ template: './public/index.html', // you have to have the template file }), ]; isDevelopment ? plugins.push(new ReactRefreshWebpackPlugin()) : plugins.push(new MiniCssExtractPlugin()); const config: webpack.Configuration = { mode: isDevelopment ? 'development' : 'production', devServer: { hot: true, port: 3000, }, entry: './src/index.tsx', // codes will be inside src folder output: { path: path.resolve(__dirname, 'build'), filename: 'index.js', // more configurations: https://webpack.js.org/configuration/ }, plugins, resolve: { modules: [path.resolve(__dirname, './src'), 'node_modules'], // automatically resolve certain extensions (Ex. import './file' will automatically look for file.js) extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss', '.css'], alias: { // absolute path importing files '@pages': path.resolve(__dirname, './src/pages'), }, }, module: { rules: [ { test: /\.html$/, use: ['html-loader'], }, { test: /\.(js|jsx|ts|tsx)$/, exclude: /node_modules/, use: [ { loader: require.resolve('babel-loader'), options: { plugins: [ isDevelopment && require.resolve('react-refresh/babel'), ].filter(Boolean), }, }, ], }, { test: /\.(sa|sc|c)ss$/i, // .sass or .scss use: [ // Creates `style` nodes from JS strings 'style-loader', // Translates CSS into CommonJS 'css-loader', // for Tailwind CSS 'postcss-loader', // Compiles Sass to CSS 'sass-loader', ], }, ], }, }; export default config;

  • custom-react-setup

    A complete guide for setting up a React app with webpack, Babel, and TypeScript

  • 🙏 Please visit my GitHub repository for more settings and codes.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • ts-loader

    TypeScript loader for webpack

  • why I use @babel/preset-typescript over ts-loader and awesome-typescript-loader to complie TypeScript? it's blazingly faster than the others and has more perks(read #4) ts-loader doesn't natively support HMR(Hot Module Replacement) awesome-typescript-loader's latest release is on Jun 22, 2018 TypeScript With Babel: A Beautiful Marriage - Matt Turnbull's Post

  • awesome-typescript-loader

    Discontinued Awesome TypeScript loader for webpack

  • why I use @babel/preset-typescript over ts-loader and awesome-typescript-loader to complie TypeScript? it's blazingly faster than the others and has more perks(read #4) ts-loader doesn't natively support HMR(Hot Module Replacement) awesome-typescript-loader's latest release is on Jun 22, 2018 TypeScript With Babel: A Beautiful Marriage - Matt Turnbull's Post

  • react-refresh-webpack-plugin

    A Webpack plugin to enable "Fast Refresh" (also previously known as Hot Reloading) for React components.

  • as mentioned above, we're using the webpack; therefore, we're going to use @pmmmwh/react-refresh-webpack-plugin to apply the Fast Refresh feature to our app. I mean, it's for development, so what's the harm of trying it right?

  • webpack-cli

    Webpack's Command Line Interface

  • webpack-cli(v5.0.1): enables you to use the command-line interface of the Webpack

  • React

    The library for web and native user interfaces.

  • react(v18.2.0) : The react package contains only the functionality necessary to define React components. It is typically used together with a React renderer like react-dom for the web, or react-native for the native environments.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • react-router

    Declarative routing for React

  • react-router-dom(v6.4.4): contains bindings for using React Router in web applications.

  • Babel (Formerly 6to5)

    🐠 Babel is a compiler for writing next generation JavaScript.

  • babel-loader(v9.1.0): allows transpiling JavaScript files using Babel and webpack.

  • postcss-plugins

    PostCSS Tools and Plugins

  • w/ postcss-preset-env(v7.8.3): convert modern CSS into something most browsers can understand, determining the polyfills you need based on your targeted browsers or runtime environments. It takes the support data that comes from MDN and Can I Use and determine from a browserlist whether those transformations are needed. It also packs Autoprefixer within and shares the list with it, so prefixes are only applied when you're going to need them given your browser support list.

  • browserslist

    🦔 Share target browsers between different front-end tools, like Autoprefixer, Stylelint and babel-preset-env

  • w/ postcss-preset-env(v7.8.3): convert modern CSS into something most browsers can understand, determining the polyfills you need based on your targeted browsers or runtime environments. It takes the support data that comes from MDN and Can I Use and determine from a browserlist whether those transformations are needed. It also packs Autoprefixer within and shares the list with it, so prefixes are only applied when you're going to need them given your browser support list.

  • autoprefixer

    Parse CSS and add vendor prefixes to rules by Can I Use

  • w/ postcss-preset-env(v7.8.3): convert modern CSS into something most browsers can understand, determining the polyfills you need based on your targeted browsers or runtime environments. It takes the support data that comes from MDN and Can I Use and determine from a browserlist whether those transformations are needed. It also packs Autoprefixer within and shares the list with it, so prefixes are only applied when you're going to need them given your browser support list.

  • typescript-plugin-css-modules

    A TypeScript language service plugin providing support for CSS Modules.

  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • css-modules

    Documentation about css-modules

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts