Skip to content

Commit

Permalink
allow special amd exports, should fix #34
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Nov 6, 2012
1 parent 83c3fa2 commit 80989e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/parse.js
Expand Up @@ -251,6 +251,16 @@ function walkExpression(options, context, expression) {
column: elements[idx].loc.start.column,
inTry: context.inTry
});
} else if(param.value == "exports") {
// exports
context.requires = context.requires || [];
context.requires.push({
moduleExports: true,
expressionRange: elements[idx].range,
line: elements[idx].loc.start.line,
column: elements[idx].loc.start.column,
inTry: context.inTry
});
} else {
// normal require
context.requires = context.requires || [];
Expand Down
6 changes: 6 additions & 0 deletions lib/writeSource.js
Expand Up @@ -95,6 +95,12 @@ module.exports = function(module, options, toRealId, toRealChuckId) {
to: requireItem.expressionRange[1],
value: "require"
});
} else if(requireItem.moduleExports) {
replaces.push({
from: requireItem.expressionRange[0],
to: requireItem.expressionRange[1],
value: "module.exports"
});
}
if(requireItem.amdNameRange) {
replaces.push({
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "webpack",
"version": "0.7.16",
"version": "0.7.17",
"author": "Tobias Koppers @sokra",
"description": "Packs CommonJs/AMD Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
"dependencies": {
Expand Down

0 comments on commit 80989e7

Please sign in to comment.