removed the last TODO :)
This commit is contained in:
parent
47ae6dc211
commit
dabbab4627
|
@ -26,7 +26,6 @@ RequireContextPlugin.prototype.apply = function(compiler) {
|
||||||
compilation.dependencyFactories.set(ContextElementDependency, normalModuleFactory);
|
compilation.dependencyFactories.set(ContextElementDependency, normalModuleFactory);
|
||||||
});
|
});
|
||||||
compiler.plugin("context-module-factory", function(cmf) {
|
compiler.plugin("context-module-factory", function(cmf) {
|
||||||
// TODO extract in modules
|
|
||||||
cmf.plugin("alternatives", function(items, callback) {
|
cmf.plugin("alternatives", function(items, callback) {
|
||||||
if(items.length == 0) return callback(null, items);
|
if(items.length == 0) return callback(null, items);
|
||||||
|
|
||||||
|
@ -48,10 +47,16 @@ RequireContextPlugin.prototype.apply = function(compiler) {
|
||||||
cmf.plugin("alternatives", function(items, callback) {
|
cmf.plugin("alternatives", function(items, callback) {
|
||||||
if(items.length == 0) return callback(null, items);
|
if(items.length == 0) return callback(null, items);
|
||||||
|
|
||||||
callback(null, items.filter(function(obj) {
|
callback(null, items.map(function(obj) {
|
||||||
return modulesDirectories.filter(function(dir) {
|
for(var i = 0; i < modulesDirectories.length; i++) {
|
||||||
return obj.request.indexOf("/" + dir + "/") >= 0;
|
var dir = modulesDirectories[i];
|
||||||
}) == 0;
|
var idx = obj.request.indexOf("/" + dir + "/");
|
||||||
|
if(idx >= 0) {
|
||||||
|
obj.request = obj.request.slice(idx+dir.length+2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "webpack",
|
"name": "webpack",
|
||||||
"version": "0.10.0-beta22",
|
"version": "0.10.0-beta23",
|
||||||
"author": "Tobias Koppers @sokra",
|
"author": "Tobias Koppers @sokra",
|
||||||
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
"description": "Packs CommonJs/AMD/Labeled Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -362,6 +362,7 @@ describe("main", function() {
|
||||||
(require.context("../././templates"))("./tmpl").should.be.eql("test template");
|
(require.context("../././templates"))("./tmpl").should.be.eql("test template");
|
||||||
(require.context(".././templates/.")("./tmpl")).should.be.eql("test template");
|
(require.context(".././templates/.")("./tmpl")).should.be.eql("test template");
|
||||||
require . context ( "." + "." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" ).should.be.eql("subdir test template");
|
require . context ( "." + "." + "/" + "templ" + "ates" ) ( "./subdir/tmpl.js" ).should.be.eql("subdir test template");
|
||||||
|
require.context("../templates", true, /./)("xyz").should.be.eql("xyz");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should automatically create contexts", function() {
|
it("should automatically create contexts", function() {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = "xyz";
|
Loading…
Reference in New Issue