Sublime3's Minify extension compresses the problem of js reserved keywords

Sublime's Minify extension
can compress css, js, json, html, svg, and it is very convenient if you are writing something temporarily.

However, when using it to compress js, I want to avoid compressing some keywords. For example require,
I don't know why when using seajs, the requirekeywords will be compressed and an error will be reported,
so I want to configure this Minify to avoid compressing keywords.

After configuration "uglifyjs_options": "-c -m reserved=['$','require']", it is found that an error will be reported,
and there are two error messages -m, so I think it should be included in the default configuration of Minify.

Sure enough, I clicked Preferences -> Browse Packages..., found Minify/Minify.py, and
searched for uglifyjs, and I soon found this sentence (about 104 lines):

cmd.extend([self.quoteChrs(inpfile), '-o', self.quoteChrs(outfile), '-m', '-c'])

So it will be , '-m', '-c'deleted, then restarted, and then compressed with the above configuration to achieve the expected effect:

// 压缩前:
define(function(require, exports, module){});

// 压缩后:
define(function(require,e,s){});

Summary:
Reasonable inferences are important!

Additional corrections are welcome!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324756892&siteId=291194637