jeudi 30 juillet 2020

How to get original function parameter names in production webpack build

I'm trying to implement something similar to dependency injection, By getting parameter names from a function exposed by a javascript module, something like this:

module.exports = (router,form,query,url) => {

    // Do something with these parameters ...

    return response;
};

I can solve this problem by parsing the string representation of the function. There's already a SO thread for that.

My problem becomes apparent when the code is bundled for production with webpack, all the parameter names get mangled, and the original names are lost.

I couldn't find any option in the webpack config that can help me with that.

Is there a way to do what I want without making the module that exports the function worry about anything related to this problem?





Aucun commentaire:

Enregistrer un commentaire