From d836b4179d76838e626eb95fc41b2b3d49d19650 Mon Sep 17 00:00:00 2001 From: KHEDRI ZINEDDINE <57670195+khedri-zineddine@users.noreply.github.com> Date: Mon, 7 Mar 2022 17:03:53 +0100 Subject: [PATCH] allow source map for only allowedExtensions because by ignoring this verification will fire error for other files --- plugin/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/index.ts b/plugin/index.ts index c1ac748..91d246e 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -70,7 +70,10 @@ export class WebpackObfuscatorPlugin { compilation.chunks.forEach(chunk => { chunk.files.forEach((fileName: string) => { - if (this.options.sourceMap && fileName.toLowerCase().endsWith('.map')) { + const isValidMapExtension = WebpackObfuscatorPlugin + .allowedExtensions + .some((extension: string) => fileName.toLowerCase().endsWith(`${extension}.map`)); + if (this.options.sourceMap && isValidMapExtension) { let srcName = fileName.toLowerCase().substr(0, fileName.length - 4); if (!this.shouldExclude(srcName)) {