Skip to content

Commit

Permalink
[Urthen#54] Unescape # in paths
Browse files Browse the repository at this point in the history
  • Loading branch information
gustaff-weldon committed Feb 20, 2021
1 parent 08dec5d commit d8e3d10
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,16 @@ CaseSensitivePathsPlugin.prototype.apply = function(compiler) {
});
};

const cleanupPath = (resourcePath) => {
// Trim ? off, since some loaders add that to the resource they're attemping to load
return resourcePath.split('?')[0]
// replace escaped \0# with # see: https://github.com/webpack/enhanced-resolve#escaping
.replace(/\\0#/, '#');
}

const onAfterResolve = (data, done) => {
this.primeCache(() => {
// Trim ? off, since some loaders add that to the resource they're attemping to load
let pathName = (data.createData || data).resource.split('?')[0];
let pathName = cleanupPath((data.createData || data).resource);
pathName = pathName.normalize ? pathName.normalize('NFC') : pathName;

checkFile(pathName, data, done);
Expand Down

0 comments on commit d8e3d10

Please sign in to comment.