From 67e521970635062e1235313b023f64b15c8d126f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Mendoza=20P=C3=A9rez?= Date: Fri, 19 Apr 2024 07:01:19 +0200 Subject: [PATCH] added webpack to keep function names untouched when bundling --- nextjs-ecommerce-oneclick/next.config.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 nextjs-ecommerce-oneclick/next.config.js diff --git a/nextjs-ecommerce-oneclick/next.config.js b/nextjs-ecommerce-oneclick/next.config.js new file mode 100644 index 00000000..62de3149 --- /dev/null +++ b/nextjs-ecommerce-oneclick/next.config.js @@ -0,0 +1,22 @@ +// next.config.js +const TerserPlugin = require('terser-webpack-plugin'); + +module.exports = { + future: { + webpack5: true, + }, + webpack: function (config) { + Object.assign(config.optimization, { + minimize: false, + minimizer: [ + new TerserPlugin({ + terserOptions: { + keep_fnames: true, // don't strip function names in production + }, + }), + ], + }); + + return config; + }, +};