diff --git a/scripts/nx/playwright-plugin.ts b/scripts/nx/playwright-plugin.ts index 464ff3ac00c..91892c9d7da 100644 --- a/scripts/nx/playwright-plugin.ts +++ b/scripts/nx/playwright-plugin.ts @@ -96,12 +96,17 @@ const BUILD_INPUTS: TargetConfiguration['inputs'] = [ '^production', ] -const PLAYWRIGHT_TOOLCHAINS = ['vite'] as const +const PLAYWRIGHT_TOOLCHAINS = ['vite', 'rsbuild'] as const const PLAYWRIGHT_MODES = ['ssr', 'spa', 'prerender', 'preview'] as const type PlaywrightToolchain = (typeof PLAYWRIGHT_TOOLCHAINS)[number] type PlaywrightMode = (typeof PLAYWRIGHT_MODES)[number] +const PLAYWRIGHT_BUILD_COMMANDS: Record = { + vite: 'vite build && tsc --noEmit', + rsbuild: 'rsbuild build && tsc --noEmit', +} + type PlaywrightModeMetadata = { toolchain: PlaywrightToolchain mode: PlaywrightMode @@ -199,7 +204,7 @@ function buildModeTargets( targets[buildTargetName] = { executor: 'nx:run-commands', options: { - command: 'vite build && tsc --noEmit', + command: PLAYWRIGHT_BUILD_COMMANDS[modeMetadata.toolchain], cwd: projectRoot, env: modeEnv, },