-
Notifications
You must be signed in to change notification settings - Fork 0
/
.uglifyrc
54 lines (54 loc) · 8.8 KB
/
.uglifyrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//Compression options for UglifyJS
{
// "arguments": , // (default: true) -- replace arguments[index] with function parameter name whenever possible.
// "assignments": , // (default: true) -- apply optimizations to assignment expressions.
"booleans": false, // (default: true) -- various optimizations for boolean context, for example !!a ? b : c → a ? b : c
// "collapse_vars": , // (default: true) -- Collapse single-use non-constant variables, side effects permitting.
// "comparisons": , // (default: true) -- apply certain optimizations to binary nodes, e.g. !(a <= b) → a > b, attempts to negate binary nodes, e.g. a = !b && !c && !d && !e → a=!(b||c||d||e) etc.
// "conditionals": , // (default: true) -- apply optimizations for if-s and conditional expressions
// "dead_code": , // (default: true) -- remove unreachable code
// "directives": , // (default: true) -- remove redundant or non-standard directives
// "drop_console": , // (default: false) -- Pass true to discard calls to console.* functions. If you wish to drop a specific function call such as console.info and/or retain side effects from function arguments after dropping the function call then use pure_funcs instead.
// "drop_debugger": notDebug, // (default: true) -- remove debugger; statements
// "evaluate": , // (default: true) -- attempt to evaluate constant expressions
// "expression": , // (default: false) -- Pass true to preserve completion values from terminal statements without return, e.g. in bookmarklets.
// "functions": , // (default: true) -- convert declarations from varto function whenever possible.
// "global_defs": , // (default: {}) -- see conditional compilation
// "hoist_funs": , // (default: false) -- hoist function declarations
// "hoist_props": , // (default: true) -- hoist properties from constant object and array literals into regular variables subject to a set of constraints. For example: var o={p:1, q:2}; f(o.p, o.q); is converted to f(1, 2);. Note: hoist_props works best with mangle enabled, the compress option passes set to 2 or higher, and the compress option toplevel enabled.
// "hoist_vars": , // (default: false) -- hoist var declarations (this is false by default because it seems to increase the size of the output in general)
// "if_return": , // (default: true) -- optimizations for if/return and if/continue
// "inline": , // (default: true) -- inline calls to function with simple/return statement:
// false -- same as 0
// 0 -- disabled inlining
// 1 -- inline simple functions
// 2 -- inline functions with arguments
// 3 -- inline functions with arguments and variables
// true -- same as 3
// "join_vars": , // (default: true) -- join consecutive var statements
// "keep_fargs": , // (default: strict) -- Discard unused function arguments. Code which relies on Function.length will break if this is done indiscriminately, i.e. when passing true. Pass false to always retain function arguments.
"keep_fnames": true // (default: false) -- Pass true to prevent the compressor from discarding function names. Useful for code relying on Function.prototype.name. See also: the keep_fnames mangle option.
// "keep_infinity": , // (default: false) -- Pass true to prevent Infinity from being compressed into 1/0, which may cause performance issues on Chrome.
// "loops": , // (default: true) -- optimizations for do, while and for loops when we can statically determine the condition.
// "negate_iife": , // (default: true) -- negate "Immediately-Called Function Expressions" where the return value is discarded, to avoid the parens that the code generator would insert.
// "passes": , // (default: 1) -- The maximum number of times to run compress. In some cases more than one pass leads to further compressed code. Keep in mind more passes will take more time.
// "properties": , // (default: true) -- rewrite property access using the dot notation, for example foo["bar"] → foo.bar
// "pure_funcs": , // (default: null) -- You can pass an array of names and UglifyJS will assume that those functions do not produce side effects. DANGER: will not check if the name is redefined in scope. An example case here, for instance var q = Math.floor(a/b). If variable q is not used elsewhere, UglifyJS will drop it, but will still keep the Math.floor(a/b), not knowing what it does. You can pass pure_funcs: [ 'Math.floor' ] to let it know that this function won't produce any side effect, in which case the whole statement would get discarded. The current implementation adds some overhead (compression will be slower). Make sure symbols under pure_funcs are also under mangle.reserved to avoid mangling.
// "pure_getters": , // (default: "strict") -- If you pass true for this, UglifyJS will assume that object property access (e.g. foo.bar or foo["bar"]) doesn't have any side effects. Specify "strict" to treat foo.bar as side-effect-free only when foo is certain to not throw, i.e. not null or undefined.
// "reduce_funcs": , // (default: true) -- Allows single-use functions to be inlined as function expressions when permissible allowing further optimization. Enabled by default. Option depends on reduce_vars being enabled. Some code runs faster in the Chrome V8 engine if this option is disabled. Does not negatively impact other major browsers.
// "reduce_vars": , // (default: true) -- Improve optimization on variables assigned with and used as constant values.
// "sequences": , // (default: true) -- join consecutive simple statements using the comma operator. May be set to a positive integer to specify the maximum number of consecutive comma sequences that will be generated. If this option is set to true then the default sequences limit is 200. Set option to false or 0 to disable. The smallest sequences length is 2. A sequences value of 1 is grandfathered to be equivalent to true and as such means 200. On rare occasions the default sequences limit leads to very slow compress times in which case a value of 20 or less is recommended.
// "side_effects": , // (default: true) -- Pass false to disable potentially dropping functions marked as "pure". A function call is marked as "pure" if a comment annotation /*@__PURE__*/ or /*#__PURE__*/ immediately precedes the call. For example: /*@__PURE__*/foo();
// "switches": , // (default: true) -- de-duplicate and remove unreachable switch branches
// "toplevel": , // (default: false) -- drop unreferenced functions ("funcs") and/or variables ("vars") in the top level scope (false by default, true to drop both unreferenced functions and variables)
// "top_retain": , // (default: null) -- prevent specific toplevel functions and variables from unused removal (can be array, comma-separated, RegExp or function. Implies toplevel)
// "typeofs": , // (default: true) -- Transforms typeof foo == "undefined" into foo === void 0. Note: recommend to set this value to false for IE10 and earlier versions due to known issues.
// "unsafe": , // (default: false) -- apply "unsafe" transformations (discussion below)
// "unsafe_comps": , // (default: false) -- compress expressions like a <= b assuming none of the operands can be (coerced to) NaN.
// "unsafe_Function": , // (default: false) -- compress and mangle Function(args, code) when both args and code are string literals.
// "unsafe_math": , // (default: false) -- optimize numerical expressions like 2 * x * 3 into 6 * x, which may give imprecise floating point results.
// "unsafe_proto": , // (default: false) -- optimize expressions like Array.prototype.slice.call(a) into [].slice.call(a)
// "unsafe_regexp": , // (default: false) -- enable substitutions of variables with RegExp values the same way as if they are constants.
// "unsafe_undefined": , // (default: false) -- substitute void 0 if there is a variable named undefined in scope (variable name will be mangled, typically reduced to a single character)
// "unused": , // (default: true) -- drop unreferenced functions and variables (simple direct variable assignments do not count as references unless set to "keep_assign")
}