Skip to content

Commit 4a8bf92

Browse files
committed
loader regExp compares to resourcePath instead of resource
webpack#729
1 parent a4e3b64 commit 4a8bf92

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎lib/NormalModuleFactory.js‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,18 @@ NormalModuleFactory.prototype.create = function(context, dependency, callback) {
6363
request + " (ignored)")); // ignored
6464

6565
var userRequest = loaders.concat([resource]).join("!");
66+
67+
var resourcePath = resource;
68+
var queryIndex = resourcePath.indexOf("?");
69+
if(queryIndex >= 0)
70+
resourcePath = resourcePath.substr(0, queryIndex);
6671

6772
if(noPrePostAutoLoaders)
6873
return onDoneResolving.call(this);
6974
if(noAutoLoaders) {
7075
async.parallel([
71-
this.resolveRequestArray.bind(this, context, noPostAutoLoaders ? [] : this.postLoaders.match(resource), this.resolvers.loader),
72-
this.resolveRequestArray.bind(this, context, this.preLoaders.match(resource), this.resolvers.loader)
76+
this.resolveRequestArray.bind(this, context, noPostAutoLoaders ? [] : this.postLoaders.match(resourcePath), this.resolvers.loader),
77+
this.resolveRequestArray.bind(this, context, this.preLoaders.match(resourcePath), this.resolvers.loader)
7378
], function(err, results) {
7479
if(err) return callback(err);
7580
loaders = results[0].concat(loaders).concat(results[1]);
@@ -78,8 +83,8 @@ NormalModuleFactory.prototype.create = function(context, dependency, callback) {
7883
} else {
7984
async.parallel([
8085
this.resolveRequestArray.bind(this, context, noPostAutoLoaders ? [] : this.postLoaders.match(resource), this.resolvers.loader),
81-
this.resolveRequestArray.bind(this, context, this.loaders.match(resource), this.resolvers.loader),
82-
this.resolveRequestArray.bind(this, context, this.preLoaders.match(resource), this.resolvers.loader)
86+
this.resolveRequestArray.bind(this, context, this.loaders.match(resourcePath), this.resolvers.loader),
87+
this.resolveRequestArray.bind(this, context, this.preLoaders.match(resourcePath), this.resolvers.loader)
8388
], function(err, results) {
8489
if(err) return callback(err);
8590
loaders = results[0].concat(loaders).concat(results[1]).concat(results[2]);

0 commit comments

Comments
 (0)