From 114ad859f89f91a45db20ab557208f976e721765 Mon Sep 17 00:00:00 2001 From: gustaff-weldon Date: Fri, 19 Feb 2021 21:14:05 +0100 Subject: [PATCH] [#54] Unescape # in paths --- index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index c46c2b2..7981080 100644 --- a/index.js +++ b/index.js @@ -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);