Table of Contents
  • CreateReactApp

    published: 2026-07-02

    tags: development,javascript,react,CreateReactApp

    for es6 and manual setup This approach will use Webpack for module bundling and Babel for transpiling ES6+ syntax.

    suggested "module": "esnext", - replaced with "module": "es2020", as its more stable for production

    suggested "moduleResolution": "node", - replaced with "moduleResolution": "node10", as node more backwards compatible, however we are creating latest from scratch so should use latest settings

    check created tsconfig.json file against the settings below

    {
      "compilerOptions": {
        "target": "es6",  // Set the target to ES6
        "module": "es2020",  // Set the module format to ES2020
        "lib": ["dom", "dom.iterable", "esnext"],
        "allowJs": true,
        "skipLibCheck": true,
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "strict": true,
        "forceConsistentCasingInFileNames": true,
        "noFallthroughCasesInSwitch": true,
        "moduleResolution": "node10",
        "resolveJsonModule": true,
        "isolatedModules": true,
        "noEmit": true,
        "jsx": "react-jsx"
      },
      "include": ["src"]
    }

    notes

    target

    Specifies the ECMAScript version your TypeScript code is compiled down to. It determines which modern JavaScript features are preserved or transformed (e.g., arrow functions, async/await).


    module

    Defines the module system used in the compiled JavaScript output.

    Prefer "NodeNext" for Node.js ESM, "esnext" for browser apps with bundlers.


    moduleResolution

    Controls how TypeScript resolves import paths to actual files.


    lib

    Specifies built-in API types available in your project (e.g., Promise, fetch, console).

    const path = require('path');
    
    module.exports = {
      entry: './src/index.tsx',
      output: {
        filename: 'bundle.js',
        path: path.resolve(__dirname, 'dist'),
      },
      module: {
        rules: [
          {
            test: /\.tsx?$/,
            use: 'ts-loader',
            exclude: /node_modules/,
          },
          {
            test: /\.css$/,
            use: ['style-loader', 'css-loader'],
          },
        ],
      },
      resolve: {
        extensions: ['.tsx', '.ts', '.js'],
      },
      devServer: {
        static: {
          directory: path.join(__dirname, 'dist'),
        },
        hot: true,
      },
    };
    import React from 'react';
    
    const App: React.FC = () => {
      return (
        <div>
          <h1>Hello, World!</h1>
        </div>
      );
    };
    
    export default App;
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>React TypeScript App</title>
    </head>
    <body>
      <div id="root"></div>
      <script src="/bundle.js"></script>
    </body>
    </html>
    import React from 'react';
    import { createRoot } from 'react-dom/client';
    import App from './app';
    
    const rootElement = document.getElementById('root');
    if (rootElement) 
    {
    	const root = createRoot(rootElement);
    
    	root.render(
    	  <React.StrictMode>
    		<App />
    	  </React.StrictMode>
    	);
    }