Skip to content

Commit

Permalink
fix(remainingRequest): resolve issue when multiple variables are expo…
Browse files Browse the repository at this point in the history
…sed for the same request. (#30)

The previous commit for more consistent hashes naively overwrote the
entire request, assuming there weren't additional loaders to be run
against the file.  This modifies the changes to the request to only change
the path to the imported file rather than changing the entire
remainingRequest.
  • Loading branch information
gdborton authored and joshwiens committed Nov 18, 2017
1 parent 14418a3 commit 335f9e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ module.exports.pitch = function(remainingRequest) {
// Change the request from an /abolute/path.js to a relative ./path.js
// This prevents [chunkhash] values from changing when running webpack
// builds in different directories.
var newRequestPath = "." + path.sep + path.basename(remainingRequest);
const newRequestPath = remainingRequest.replace(
this.resourcePath,
'.' + path.sep + path.relative(this.context, this.resourcePath)
);
this.cacheable && this.cacheable();
if(!this.query) throw new Error("query parameter is missing");
return accesorString(this.query.substr(1)) + " = " +
Expand Down

0 comments on commit 335f9e6

Please # to comment.