mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
uglify: disable negate_iife
This commit is contained in:
+25
-11
@@ -47,38 +47,46 @@ exports.getUglifyOptions = function (platform, flags) {
|
||||
var optimizeForJSC = releaseMode && global_defs['CC_JSB'];
|
||||
if (optimizeForJSC) {
|
||||
return {
|
||||
output: {
|
||||
beautify: true, // really preserve_lines
|
||||
indent_level: 0, // reduce jsc file size
|
||||
parse: {
|
||||
bare_returns: true
|
||||
},
|
||||
toplevel: false,
|
||||
compress: {
|
||||
global_defs: global_defs,
|
||||
negate_iife: false,
|
||||
sequences: false,
|
||||
keep_infinity: true, // reduce jsc file size
|
||||
typeofs: false,
|
||||
},
|
||||
output: {
|
||||
beautify: true, // really preserve_lines
|
||||
indent_level: 0, // reduce jsc file size
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (releaseMode) {
|
||||
return {
|
||||
parse: {
|
||||
bare_returns: true
|
||||
},
|
||||
toplevel: false,
|
||||
compress: {
|
||||
global_defs: global_defs,
|
||||
negate_iife: false,
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
mangle: false,
|
||||
//preserveComments: 'all',
|
||||
output: {
|
||||
// http://lisperator.net/uglifyjs/codegen
|
||||
beautify: true,
|
||||
indent_level: 2,
|
||||
parse: {
|
||||
bare_returns: true
|
||||
},
|
||||
toplevel: false,
|
||||
compress: {
|
||||
// https://github.com/mishoo/UglifyJS2#compressor-options
|
||||
global_defs: global_defs,
|
||||
negate_iife: false,
|
||||
sequences: false, // join consecutive statements with the “comma operator”
|
||||
properties: false, // optimize property access: a["foo"] → a.foo
|
||||
//dead_code: true, // discard unreachable code
|
||||
@@ -99,7 +107,6 @@ exports.getUglifyOptions = function (platform, flags) {
|
||||
collapse_vars: false, // Collapse single-use non-constant variables - side effects permitting.
|
||||
reduce_vars: false, // Improve optimization on variables assigned with and used as constant values.
|
||||
//warnings: true,
|
||||
negate_iife: false,
|
||||
pure_getters: false,
|
||||
pure_funcs: null,
|
||||
drop_console: false,
|
||||
@@ -108,7 +115,14 @@ exports.getUglifyOptions = function (platform, flags) {
|
||||
keep_fnames: true,
|
||||
keep_infinity: true, // Pass true to prevent Infinity from being compressed into 1/0, which may cause performance issues on Chrome.
|
||||
side_effects: false // drop side-effect-free statements
|
||||
}
|
||||
},
|
||||
mangle: false,
|
||||
//preserveComments: 'all',
|
||||
output: {
|
||||
// http://lisperator.net/uglifyjs/codegen
|
||||
beautify: true,
|
||||
indent_level: 2,
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user