From 9444dddd497325a1e296938737b4ae62e93e258f Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 4 Dec 2022 19:08:33 +0100 Subject: [PATCH] Refactor sourcemap path fix --- webpack.config.ts | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/webpack.config.ts b/webpack.config.ts index 498aeee..5fea45b 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -3,7 +3,7 @@ import { dirname, isAbsolute, relative, resolve } from "path"; import { fileURLToPath } from "url"; import exports, { Configuration } from "webpack"; -const { WatchIgnorePlugin, SourceMapDevToolPlugin } = exports; +const { WatchIgnorePlugin } = exports; let dirName = fileURLToPath(new URL(".", import.meta.url)); @@ -36,16 +36,7 @@ let generator = (env: any, argv: any): Configuration[] => } else { - let fallback = new SourceMapDevToolPlugin().moduleFilenameTemplate; - - if (typeof fallback === "function") - { - return fallback(context); - } - else - { - return fallback; - } + return `webpack://${context.namespace}/${context.resourcePath}${context.loaders === "" ? "" : `?${context.loaders}`}`; } }, libraryTarget: "module", @@ -102,6 +93,8 @@ let generator = (env: any, argv: any): Configuration[] => sourceMap.sources = sourceMap.sources.map( (source: string) => { + console.log(source); + // Prevent `webpack://` sources from being changed if (isAbsolute(source)) {