use custom polyfill for path.join (fix webpack 5 build)

This commit is contained in:
garronej
2021-12-16 20:44:39 +01:00
parent 46bd319ebe
commit 1138313028
4 changed files with 8 additions and 5 deletions

View File

@ -4,7 +4,7 @@ import type { KcProps } from "./KcProps";
import type { KcContextBase } from "../getKcContext/KcContextBase"; import type { KcContextBase } from "../getKcContext/KcContextBase";
import { useKcMessage } from "../i18n/useKcMessage"; import { useKcMessage } from "../i18n/useKcMessage";
import { headInsert } from "../tools/headInsert"; import { headInsert } from "../tools/headInsert";
import { join as pathJoin } from "path"; import { pathJoin } from "../tools/pathJoin";
import { useCssAndCx } from "tss-react"; import { useCssAndCx } from "tss-react";
export const LoginOtp = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginOtp } & KcProps) => { export const LoginOtp = memo(({ kcContext, ...props }: { kcContext: KcContextBase.LoginOtp } & KcProps) => {

View File

@ -5,7 +5,7 @@ import { getKcLanguageTagLabel } from "../../i18n/KcLanguageTag";
//NOTE: Aside because we want to be able to import them from node //NOTE: Aside because we want to be able to import them from node
import { resourcesCommonPath, resourcesPath } from "./urlResourcesPath"; import { resourcesCommonPath, resourcesPath } from "./urlResourcesPath";
import { id } from "tsafe/id"; import { id } from "tsafe/id";
import { join as pathJoin } from "path"; import { pathJoin } from "../../tools/pathJoin";
const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/"; const PUBLIC_URL = process.env["PUBLIC_URL"] ?? "/";

View File

@ -1,5 +1,5 @@
import { join as pathJoin } from "path"; import { pathJoin } from "../../tools/pathJoin";
export const subDirOfPublicDirBasename = "keycloak_static"; export const subDirOfPublicDirBasename = "keycloak_static";
export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "/resources"); export const resourcesPath = pathJoin(subDirOfPublicDirBasename, "resources");
export const resourcesCommonPath = pathJoin(subDirOfPublicDirBasename, "/resources_common"); export const resourcesCommonPath = pathJoin(subDirOfPublicDirBasename, "resources_common");

View File

@ -0,0 +1,3 @@
export function pathJoin(...path: string[]): string {
return path.map(part => part.replace(/^\/+/, "").replace(/\/+$/, "")).join("/");
}