'Uncaught TypeError: Found non-callable @@iterator (react/typescript|esbuild-loader)

So i am trying to replace ts-loader with esbuild-loader in webpack, however it seems like as soon as I make the change, the page stops working.

{
    test: /\.tsx?$/,
    loader: 'esbuild-loader',
    options: {
      loader: 'tsx',
      target: 'es2015',
    },
    exclude: /node_modules/,
  },

The error I am getting is Uncaught TypeError: Found non-callable @@iterator . In my opinion the target could be the culprit, but changing the target to 'es5' is not supported.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source