From 99b0b67f77766459013c8cd082d8b88d858b9b16 Mon Sep 17 00:00:00 2001 From: Joseph Garrone Date: Sun, 16 Jun 2024 14:58:51 +0200 Subject: [PATCH] Add publicDirpath option for webpack --- src/bin/shared/buildContext.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/bin/shared/buildContext.ts b/src/bin/shared/buildContext.ts index ae5593b3..ea8f0557 100644 --- a/src/bin/shared/buildContext.ts +++ b/src/bin/shared/buildContext.ts @@ -139,6 +139,7 @@ export function getBuildContext(params: { type BuildOptions_packageJson = BuildOptions & { projectBuildDirPath?: string; staticDirPathInProjectBuildDirPath?: string; + publicDirPath?: string; }; type ParsedPackageJson = { @@ -173,6 +174,7 @@ export function getBuildContext(params: { themeName: z.union([z.string(), z.array(z.string())]).optional(), themeVersion: z.string().optional(), staticDirPathInProjectBuildDirPath: z.string().optional(), + publicDirPath: z.string().optional(), keycloakVersionTargets: id< z.ZodType >( @@ -377,14 +379,21 @@ export function getBuildContext(params: { ); })(), publicDirPath: (() => { + if (process.env.PUBLIC_DIR_PATH !== undefined) { + return getAbsoluteAndInOsFormatPath({ + pathIsh: process.env.PUBLIC_DIR_PATH, + cwd: projectDirPath + }); + } + webpack: { if (resolvedViteConfig !== undefined) { break webpack; } - if (process.env.PUBLIC_DIR_PATH !== undefined) { + if (buildOptions.publicDirPath !== undefined) { return getAbsoluteAndInOsFormatPath({ - pathIsh: process.env.PUBLIC_DIR_PATH, + pathIsh: buildOptions.publicDirPath, cwd: projectDirPath }); }