-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call cyclical module entry points and fix cyclical module.parent
- Loading branch information
1 parent
aeacbdd
commit d483818
Showing
7 changed files
with
75 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
(function(){ | ||
var createModuleFactory = function createModuleFactory(factory) { | ||
var module | ||
return function () { | ||
return function (parent) { | ||
if (!module) { | ||
module = { exports: {} } | ||
module = { exports: {}, parent: parent } | ||
factory(module, module.exports) | ||
} | ||
return module.exports | ||
} | ||
}; | ||
var _$a_1 = createModuleFactory(function (module, exports) { | ||
var b = _$b_3() | ||
var b = _$b_3({}) | ||
module.exports = function () { | ||
return b() | ||
} | ||
|
||
}); | ||
var _$b_3 = createModuleFactory(function (module, exports) { | ||
module.exports = function () { | ||
return _$a_1().toString() | ||
return _$a_1({}).toString() | ||
} | ||
|
||
}); | ||
var _$app_2 = {}; | ||
console.log( | ||
_$a_1()() | ||
_$a_1({})() | ||
) | ||
|
||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
exports.a = 1 | ||
exports.b = 2 | ||
|
||
require('./router') | ||
|
||
if (!module.parent) { | ||
console.log(exports.a + exports.b) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
if (module.parent) { | ||
require('./app').a = 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters