Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/nx/playwright-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<PlaywrightToolchain, string> = {
vite: 'vite build && tsc --noEmit',
rsbuild: 'rsbuild build && tsc --noEmit',
}

type PlaywrightModeMetadata = {
toolchain: PlaywrightToolchain
mode: PlaywrightMode
Expand Down Expand Up @@ -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,
},
Expand Down
Loading