dimanche 24 octobre 2021

terser Webpack plugin margle unwanted props

I am using treser webpack plugin with :

      optimization: {
        minimize: true,
        minimizer: [new TerserPlugin({
          top_level: true,
          mangle: {
          //properties: true
           reserved:['contact'],
          keep_classnames: false,
         keep_fnames: false
          }
        })]
    }

My goal is to remove func names from the prototype with typescript code to one js bundle that works fine. However, I saw that when my code has variable: this.contact = {firstname:'user'} its compiled to contact.a and not contact.firstname. I dont want to margle this saved var. How can I do it and not destroy nested object..




Aucun commentaire:

Enregistrer un commentaire