Uglify mangle keep_quoted but ONLY where quoted

313 Views Asked by At

I have a scenario where I want to expose certain properties to other API's on the page, but internally keep those property names mangled. Uglify's "keep_quoted" option seems like it should do what I want, but instead it prevents every instance of anything that's quoted at least once from being mangled

For example, if in my src I had:

const myID = 1;
const myObj = {
  'myID': myID
};

I would expect Uglify to output the following:

const a=1;const b={'myID':a};

But instead it gives me:

const myID=1;const b={'myID':myID};

The 'myID' is prevented from being mangled EVERYWHERE just because it was quoted in one place.

I'm big enough and ugly enough to remember to add quotes around my propertyNames wherever I need to them to be exported. How can I get Uglify to mangle the ones that I chose not to add quotes to?

0

There are 0 best solutions below