From 2192c7e28e7732a199664e2336dee1a71f9b7499 Mon Sep 17 00:00:00 2001 From: JeffSlutz Date: Tue, 12 Jun 2018 14:37:11 -0600 Subject: [PATCH] feat(build): remove unneccessary windows cleaning It was not neccessary to clean the modulePaths in getNodeModuleData(). Removed that code. This is believed to be a non-breaking change. --- src/PreserveModuleNamePlugin.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/PreserveModuleNamePlugin.ts b/src/PreserveModuleNamePlugin.ts index 62a662e..7b86ed7 100644 --- a/src/PreserveModuleNamePlugin.ts +++ b/src/PreserveModuleNamePlugin.ts @@ -199,22 +199,11 @@ function getNodeModuleData(module: Webpack.Module): NodeModule.Data | null { return null; } - function cleanWindowsPaths(paths: RegExpMatchArray | null) { - var out: string[] = []; - if (!paths) { - return out; - } - for (var i = 0; i < paths.length; i += 1) { - out[i] = paths[i].replace(':', '').split('\\').join('/'); - } - return out; - } - // Note that the negative lookahead (?!.*node_modules) ensures that we only match the last node_modules/ folder in the path, // in case the package was located in a sub-node_modules (which can occur in special circumstances). // We also need to take care of scoped modules. If the name starts with @ we must keep two parts, // so @corp/bar is the proper module name. - const modulePaths = cleanWindowsPaths(module.resource.match(/(.*\bnode_modules[\\/](?!.*\bnode_modules\b)((?:@[^\\/]+[\\/])?[^\\/]+))(.*)/i)); + const modulePaths = module.resource.match(/(.*\bnode_modules[\\/](?!.*\bnode_modules\b)((?:@[^\\/]+[\\/])?[^\\/]+))(.*)/i); if (!modulePaths || modulePaths.length !== 4) { return null; }