Skip to content

Commit f373fef

Browse files
gdbortonjoshwiens
authored andcommitted
fix(remainingRequest): resolve issue when multiple variables are exposed 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.
1 parent dba8a03 commit f373fef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ module.exports.pitch = function(remainingRequest) {
2626
// Change the request from an /abolute/path.js to a relative ./path.js
2727
// This prevents [chunkhash] values from changing when running webpack
2828
// builds in different directories.
29-
var newRequestPath = "." + path.sep + path.basename(remainingRequest);
29+
const newRequestPath = remainingRequest.replace(
30+
this.resourcePath,
31+
'.' + path.sep + path.relative(this.context, this.resourcePath)
32+
);
3033
this.cacheable && this.cacheable();
3134
if(!this.query) throw new Error("query parameter is missing");
3235
return accesorString(this.query.substr(1)) + " = " +

0 commit comments

Comments
 (0)