Webpack generates arrow function in ES5
The decision is simply adding target: ['web', 'es5']
to your webpack configuration.
You could also set target: 'es5'
, but in this case, there are some problems. At least in my case without specifying 'web' TerserWebpackPlugin refused to compress files in the production mode.
That's the problem I faced last week after upgrading the webpack to version 5.
By default, it's bundling it as ES6. In your webpack configuration, configuring output.environment
should resolve the problem.
Edit: webpack only change it's internal usages with these configurations.
webpack.js.org/configuration/output/#outputenvironment
It does not compile the modules. For the module compilation, babel should be used.