Skip to content

Commit 80989e7

Browse files
committed
allow special amd exports, should fix webpack#34
1 parent 83c3fa2 commit 80989e7

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/parse.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,16 @@ function walkExpression(options, context, expression) {
251251
column: elements[idx].loc.start.column,
252252
inTry: context.inTry
253253
});
254+
} else if(param.value == "exports") {
255+
// exports
256+
context.requires = context.requires || [];
257+
context.requires.push({
258+
moduleExports: true,
259+
expressionRange: elements[idx].range,
260+
line: elements[idx].loc.start.line,
261+
column: elements[idx].loc.start.column,
262+
inTry: context.inTry
263+
});
254264
} else {
255265
// normal require
256266
context.requires = context.requires || [];

lib/writeSource.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ module.exports = function(module, options, toRealId, toRealChuckId) {
9595
to: requireItem.expressionRange[1],
9696
value: "require"
9797
});
98+
} else if(requireItem.moduleExports) {
99+
replaces.push({
100+
from: requireItem.expressionRange[0],
101+
to: requireItem.expressionRange[1],
102+
value: "module.exports"
103+
});
98104
}
99105
if(requireItem.amdNameRange) {
100106
replaces.push({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack",
3-
"version": "0.7.16",
3+
"version": "0.7.17",
44
"author": "Tobias Koppers @sokra",
55
"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.",
66
"dependencies": {

0 commit comments

Comments
 (0)