Привет.
У меня есть react.js ts с кастомным конфигом webpack для ответа на post запросы, так же как будто это get запросы.
Вот мой 
webpack.config.js
const path = require('path');

module.exports = {
    entry: './src/index.tsx',
    output: {
        path: path.resolve(__dirname, 'dist'),
        filename: 'bundle.js',
    },
    module: {
        rules: [
            {
                test: /\.(ts|tsx)$/,
                use: 'ts-loader',
                exclude: /node_modules/,
            },
            {
                test: /\.s[ac]ss$/i,
                use: [
                    'style-loader',
                    'css-loader',
                    'sass-loader',
                ],
            },
        ],
    },
    resolve: {
        extensions: ['.ts', '.tsx', '.js', '.jsx'],
    },
    devServer: {
        static: {
            directory: path.join(__dirname, 'dist'),
        },
        historyApiFallback: true,
        port: 5000,
        open: true,
        setupMiddlewares: (middlewares, devServer) => {
            // Обработка POST запросов
            devServer.app.post('*', (req, res) => {
                res.redirect(req.originalUrl);
            });
            return middlewares;
        },
    },
};

Вот мой package
{
  "name": "report-for-bitrix",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@types/node": "^22.10.1",
    "@types/react": "^19.0.1",
    "@types/react-dom": "^19.0.1",
    "bx24": "^0.1.3",
    "cra-template-typescript": "1.2.0",
    "mobx": "^6.13.5",
    "mobx-react-lite": "^4.0.7",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-scripts": "5.0.1",
    "sass": "^1.82.0",
    "semver": "^7.6.3",
    "typescript": "^5.7.2"
  },
  "scripts": {
    "start": "webpack serve --mode development",
    "build": "webpack --mode production"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@babel/core": "^7.26.0",
    "@babel/preset-env": "^7.26.0",
    "@babel/preset-react": "^7.26.3",
    "@babel/preset-typescript": "^7.26.0",
    "babel-loader": "^9.2.1",
    "css-loader": "^7.1.2",
    "sass-loader": "^16.0.4",
    "style-loader": "^4.0.0",
    "ts-loader": "^9.5.1",
    "webpack": "^5.97.1",
    "webpack-cli": "^5.1.4",
    "webpack-dev-server": "^5.1.0"
  }
}
Вот мой tsconfig
{
    "compilerOptions": {
      "target": "es5",
      "module": "commonjs",
      "strict": true,
      "esModuleInterop": true,
      "skipLibCheck": true,
      "forceConsistentCasingInFileNames": true,
      "outDir": "./dist",
      "sourceMap": true,
      "jsx": "react-jsx" // Используйте 'react' или 'react-jsx' в зависимости от версии React
    },
    "include": [
      "src/**/*"  // Включает все файлы в папке src
    ],
    "exclude": [
      "node_modules"  // Исключает папку node_modules
    ]
  }

Структура проекта
├── /src
  │   ├── /components
  │   ├── /Header
  │   │   ├── index.tsx
  │   │   └── style.module.scss
  │   ├── styles.d.ts
  │   └── index.tsx
  ├── package.json
  ├── webpack.config.js
  └── tsconfig.json

Я получаю ошибку 
index.tsx:10 Uncaught TypeError: Cannot read properties of undefined (reading 'header')

В компоненте Header
import styles from './style.module.scss'
console.log(styles);
const Index = () => {
    return (
        <div className={styles.header}>
            123
        </div>
    );
}

export default Index;


style.module.scss
.header {
    width: 100%;
    height: 100px;
    background: red;
}