TypeError: Cannot set property X of # which has only a getter. Ошибка при запуске кода сделанным webpack`ом

Uncaught (in promise) TypeError: Cannot set property global_timeout of # which has only a getter - вылазит вот такая ошибка и так же eslint выдает такое 'global_timeout' is read-only.eslintno-import-assign. В документации eslint`а на счет этоq ошибки не понятно что это и предлагаемый фикс не работает

package.json

{
  "name": "webpack",
  "version": "1.0.0",
  "description": "",
  "main": "common.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack"
  },
  "keywords": [
    "js",
    "javascript",
    "webpack"
  ],
  "author": "jhartum",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.15.5",
    "@babel/polyfill": "^7.12.1",
    "@babel/preset-env": "^7.15.6",
    "babel-loader": "^8.2.2",
    "webpack": "^5.52.1",
    "webpack-cli": "^4.8.0",
    "webpack-concat-plugin": "^2.4.2"
  },
  "dependencies": {
    "@babel/polyfill": "^7.12.1",
    "babel": "^6.23.0",
    "babel-polyfill": "^6.26.0",
    "exports-loader": "^3.0.0",
    "imports-loader": "^3.0.0",
    "merge-files-webpack-plugin": "^1.1.2",
    "regenerator-runtime": "^0.13.9"
  }
}

webpack.config.js

const path = require('path');

module.exports = {
  mode: 'development',
  entry: ['@babel/polyfill', './src/check.js'],
  // devtool: 'source-map',
  output: {
    filename: 'bundlse.js',
    path: path.resolve(__dirname, 'dist')
  },
  module: {
    rules: [
      {
        test: /\.m?js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      }
    ]
  }

.babelrc

{
    "presets": ["@babel/preset-env"]
  }

check.js

import {globalTimeout} from './entry.js';

export var global_timeout;

console.log('start global timeout');

globalTimeout();

entry.js

import {global_timeout} from './check.js';
    
export async function globalTimeout() {
  await new Promise((resolve, reject) => {
    global_timeout = setTimeout(() => {
      reject('Global timer timed out after 4000 ms');
    }, 4000);
  });
}

Ответы (0 шт):