Remove freeExports var when not used via exports build option.

Former-commit-id: 66950af3a18b35412fbe1092e19c5d7ef0c9a029
This commit is contained in:
John-David Dalton
2012-09-13 19:28:56 -07:00
parent 08249d78ea
commit 27247e8e56

View File

@@ -1183,6 +1183,10 @@
// remove `if (freeExports) {...}` if it's empty
source = source.replace(/(?: *\/\/.*\n)* *(?:else )?if *\(freeExports\) *{\s*}(?:\s*else *{\n([\s\S]+?) *})?/, '$1');
if ((source.match(/\bfreeExports\b/g) || []).length < 2) {
source = removeVar(source, 'freeExports');
}
/*------------------------------------------------------------------------*/
// customize Lo-Dash's IIFE