Add publicDirpath option for webpack

This commit is contained in:
Joseph Garrone
2024-06-16 14:58:51 +02:00
parent 6ec9ba3c01
commit 99b0b67f77

View File

@ -139,6 +139,7 @@ export function getBuildContext(params: {
type BuildOptions_packageJson = BuildOptions & { type BuildOptions_packageJson = BuildOptions & {
projectBuildDirPath?: string; projectBuildDirPath?: string;
staticDirPathInProjectBuildDirPath?: string; staticDirPathInProjectBuildDirPath?: string;
publicDirPath?: string;
}; };
type ParsedPackageJson = { type ParsedPackageJson = {
@ -173,6 +174,7 @@ export function getBuildContext(params: {
themeName: z.union([z.string(), z.array(z.string())]).optional(), themeName: z.union([z.string(), z.array(z.string())]).optional(),
themeVersion: z.string().optional(), themeVersion: z.string().optional(),
staticDirPathInProjectBuildDirPath: z.string().optional(), staticDirPathInProjectBuildDirPath: z.string().optional(),
publicDirPath: z.string().optional(),
keycloakVersionTargets: id< keycloakVersionTargets: id<
z.ZodType<BuildOptions.KeycloakVersionTargets> z.ZodType<BuildOptions.KeycloakVersionTargets>
>( >(
@ -377,14 +379,21 @@ export function getBuildContext(params: {
); );
})(), })(),
publicDirPath: (() => { publicDirPath: (() => {
if (process.env.PUBLIC_DIR_PATH !== undefined) {
return getAbsoluteAndInOsFormatPath({
pathIsh: process.env.PUBLIC_DIR_PATH,
cwd: projectDirPath
});
}
webpack: { webpack: {
if (resolvedViteConfig !== undefined) { if (resolvedViteConfig !== undefined) {
break webpack; break webpack;
} }
if (process.env.PUBLIC_DIR_PATH !== undefined) { if (buildOptions.publicDirPath !== undefined) {
return getAbsoluteAndInOsFormatPath({ return getAbsoluteAndInOsFormatPath({
pathIsh: process.env.PUBLIC_DIR_PATH, pathIsh: buildOptions.publicDirPath,
cwd: projectDirPath cwd: projectDirPath
}); });
} }