mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 10:17:48 +00:00
Tweak free variable module detection so it will work with Component's polyfill. [closes #296]
Former-commit-id: bda6c962dc5e8299689e4c5cf003f6a6c9a4369d
This commit is contained in:
15
build.js
15
build.js
@@ -584,12 +584,19 @@
|
||||
|
||||
var source = [
|
||||
';(function(window) {',
|
||||
" var freeExports = typeof exports == 'object' && typeof require == 'function' && exports;",
|
||||
' var undefined;',
|
||||
'',
|
||||
" var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;",
|
||||
' var objectTypes = {',
|
||||
" 'function': true,",
|
||||
" 'object': true",
|
||||
' };',
|
||||
'',
|
||||
" var freeGlobal = typeof global == 'object' && global;",
|
||||
' if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {',
|
||||
" var freeExports = objectTypes[typeof exports] && typeof require == 'function' && exports;",
|
||||
'',
|
||||
" var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module;",
|
||||
'',
|
||||
" var freeGlobal = objectTypes[typeof global] && global;",
|
||||
' if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {',
|
||||
' window = freeGlobal;',
|
||||
' }',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user