Finally got it to work by updating webpack, its plugins and adding the presets and plugins inside the webpack configuration

// Process JS with Babel.
  test: /\.(js|jsx|mjs|ts|tsx)$/,
  exclude: /node_modules/,
  include: paths.appSrc,
  use: [{
    loader: 'babel-loader',
    options: {
      presets: [
        ["@babel/preset-env", { modules: "commonjs" }],
      plugins: [

Thanks for your answers, hopefully this is useful for someone else

Related Query

More Query from same tag