Refactor sourcemap path fix
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
40b069b632
commit
9444dddd49
1 changed files with 4 additions and 11 deletions
|
@ -3,7 +3,7 @@ import { dirname, isAbsolute, relative, resolve } from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import exports, { Configuration } from "webpack";
|
import exports, { Configuration } from "webpack";
|
||||||
|
|
||||||
const { WatchIgnorePlugin, SourceMapDevToolPlugin } = exports;
|
const { WatchIgnorePlugin } = exports;
|
||||||
|
|
||||||
let dirName = fileURLToPath(new URL(".", import.meta.url));
|
let dirName = fileURLToPath(new URL(".", import.meta.url));
|
||||||
|
|
||||||
|
@ -36,16 +36,7 @@ let generator = (env: any, argv: any): Configuration[] =>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
let fallback = new SourceMapDevToolPlugin().moduleFilenameTemplate;
|
return `webpack://${context.namespace}/${context.resourcePath}${context.loaders === "" ? "" : `?${context.loaders}`}`;
|
||||||
|
|
||||||
if (typeof fallback === "function")
|
|
||||||
{
|
|
||||||
return fallback(context);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
libraryTarget: "module",
|
libraryTarget: "module",
|
||||||
|
@ -102,6 +93,8 @@ let generator = (env: any, argv: any): Configuration[] =>
|
||||||
sourceMap.sources = sourceMap.sources.map(
|
sourceMap.sources = sourceMap.sources.map(
|
||||||
(source: string) =>
|
(source: string) =>
|
||||||
{
|
{
|
||||||
|
console.log(source);
|
||||||
|
|
||||||
// Prevent `webpack://` sources from being changed
|
// Prevent `webpack://` sources from being changed
|
||||||
if (isAbsolute(source))
|
if (isAbsolute(source))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue