microbundle icon indicating copy to clipboard operation
microbundle copied to clipboard

[Docs] Mention that in mangle.json, the mangle object should be set under "minify" object

Open kenrick95 opened this issue 4 years ago • 1 comments

In both Readme and mangle.json wiki page, it mentions about how to mangle properties using mangle.json file.

It said:

This can be done in a mangle.json configuration file, [.....] follow the same object format:

{
  "mangle": {
    "properties": {
      "regex": "^_"
    }
  }
}

I assumed that mangle.json can contain exactly that, but apparently, after reading microbundle's source code, mangle.json expects that the configuration to be parked under "minify". So mangle.json should look something like this:

{
  "minify": {
    "mangle": {
      "properties": {
        "regex": "^_"
      }
    }
  }
}

Looks like this behavior is not documented anywhere 😅

kenrick95 avatar Jan 15 '21 14:01 kenrick95

~Hmm - this shouldn't be required, mangle.json should support "properties" as a top-level key. I don't believe it is nested under a mangle property, perhaps that's the issue?~

Ah, I stand corrected! This must have changed in 0.13. I think it might be worth making that key optional - this file is unlikely to ever contain any other configuration than mangling.

developit avatar Jan 15 '21 16:01 developit