How to disable uglify-js optimization which removes quotes around object literals?

I have this (legacy) code:

var object = {
  'in': 'someThing'
};

After uglify-js optimization code looks like:

var object = {
  in: 'someThing'
};

Here is lines from uglify-js readme (features list):

various small optimizations that may lead to faster code but certainly lead to smaller code. Where possible, we do the following:

foo[“bar”] => foo.bar

How to disable this optimisation? It ruins the application in IE8STD.

Answers:

Answer

According to the Documentation of UglifyJS, you could use this option:

-ns or --no-squeeze — don’t call ast_squeeze() (which does various optimizations that result in smaller, less readable code).

Answer

Flag --screw-ie8 is the solution. Check out the documentation.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.