forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
amd require is now async in webpack too
- Loading branch information
Showing
7 changed files
with
91 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
module.exports = function amdRequireFactory(req) { | ||
function amdRequire(requires, fn) { | ||
if(!fn) { | ||
function amdRequireFactory(req) { | ||
function amdRequire(chunk, requiresFn, fn) { | ||
if(!requiresFn) { | ||
// commonjs | ||
return req(requires); | ||
return req(chunk); | ||
} | ||
return fn.apply(null, requires); | ||
req.e(chunk, function() { | ||
var modules = requiresFn(); | ||
if(fn) | ||
return fn.apply(null, modules); | ||
}); | ||
} | ||
for(var name in req) | ||
amdRequire[name] = req[name]; | ||
amdRequire.amd = amdRequireFactory.amd; | ||
return amdRequire; | ||
} | ||
amdRequireFactory.amd = {}; | ||
amdRequireFactory.amd = {}; | ||
module.exports = amdRequireFactory; |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "c"; |
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 @@ | ||
module.exports = "d"; |
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