I'm trying to bundle my JS module and I need to preserve the function names as these functions will be referenced in external codebases. Below is my webpack.config.js file and as you can see, I've tried every possible option to preserve the function names but nothing is working. Any ideas?
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'src/index.js'),
mode: 'production',
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
keep_fnames: true,
keep_classnames: true,
compress: {
keep_classnames: true,
keep_fnames: true
},
mangle: false
},
}),
],
},
output :{
path: path.resolve(__dirname, 'dist'),
filename: 'index.bundle.js'
}
}