Skip to content

Commit 70e361f

Browse files
committed
Merge pull request webpack#469 from markmarijnissen/add-require-context-id
Add 'id' attribute to require.context (so HMR can accept a context)
2 parents 4e79c9f + 8fbfbc9 commit 70e361f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎lib/ContextModule.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ ContextModule.prototype.source = function(dependencyTemplates, outputOptions, re
9393
"function webpackContextResolve(req) {\n",
9494
"\treturn map[req] || (function() { throw new Error(\"Cannot find module '\" + req + \"'.\") }());\n",
9595
"};\n",
96+
"webpackContext.id = "+this.id+";\n",
9697
"webpackContext.keys = function webpackContextKeys() {\n",
9798
"\treturn Object.keys(map);\n",
9899
"};\n",
@@ -120,4 +121,4 @@ ContextModule.prototype.size = function() {
120121
return this.dependencies.map(function(dep) {
121122
return dep.userRequest.length + 5;
122123
}).reduce(function(a, b) { return a+b; }, 160);
123-
};
124+
};

0 commit comments

Comments
 (0)