webpack-contrib/terser-webpack-plugin

Provide a way to exclude specific function or imports from specific npm module

CalculonPrime opened this issue · 1 comments

Feature Proposal

Allow TerserPlugin to exclude specific functions from minimization (by name, for example). Specifically, I need to exclude renaming of the function arguments for these functions. Another option would be to have the ability to exclude all imports from a specific npm modules (under node_modules).

Feature Use Case

Minimizing app that uses module relying on function names being preserved. Such a module may inject code into a function body at runtime that tries to "observe" it, and may further assume it has its original arguments.

Please paste the results of npx webpack-cli info here, and mention other relevant information

System:
OS: Linux 5.3 openSUSE Leap 15.3
CPU: (4) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
Memory: 8.48 GB / 15.60 GB
Binaries:
Node: 12.22.10 - /usr/bin/node
npm: 6.14.16 - /usr/bin/npm
Browsers:
Firefox: 95.0.1

Webpack 5.70.0

you need to suggest this in https://github.com/terser/terser , this is issue tracker for webpack-plugin.