fix(vite): take into account configuration for build mode (#13655)
This commit is contained in:
parent
7d329c0590
commit
01b3ebd00d
@ -9,5 +9,5 @@ export interface ViteBuildExecutorOptions {
|
||||
manifest?: boolean | string;
|
||||
ssrManifest?: boolean | string;
|
||||
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
||||
mode?: string;
|
||||
mode?: 'production' | 'development';
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ export default async function* viteDevServerExecutor(
|
||||
context: ExecutorContext
|
||||
): AsyncGenerator<{ success: boolean; baseUrl: string }> {
|
||||
const mergedOptions = {
|
||||
...getBuildTargetOptions(options, context),
|
||||
...getBuildTargetOptions(options.buildTarget, context),
|
||||
...options,
|
||||
} as ViteDevServerExecutorOptions & ViteBuildExecutorOptions;
|
||||
|
||||
|
||||
@ -9,6 +9,6 @@ export interface ViteDevServerExecutorOptions {
|
||||
open?: string | boolean;
|
||||
cors?: boolean;
|
||||
logLevel?: info | warn | error | silent;
|
||||
mode?: string;
|
||||
mode?: 'production' | 'development';
|
||||
clearScreen?: boolean;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ export async function getBuildAndSharedConfig(
|
||||
const projectRoot = context.workspace.projects[context.projectName].root;
|
||||
|
||||
return mergeConfig({}, {
|
||||
mode: options.mode,
|
||||
mode: options.mode ?? context.configurationName,
|
||||
root: projectRoot,
|
||||
base: options.base,
|
||||
configFile: normalizeConfigFilePath(
|
||||
@ -97,10 +97,10 @@ export function getServerOptions(
|
||||
}
|
||||
|
||||
export function getBuildTargetOptions(
|
||||
options: ViteDevServerExecutorOptions,
|
||||
buildTarget: string,
|
||||
context: ExecutorContext
|
||||
) {
|
||||
const target = parseTargetString(options.buildTarget);
|
||||
const target = parseTargetString(buildTarget);
|
||||
return readTargetOptions(target, context);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user