fix: lazy-load Playwright to prevent it leaking into check-trigger bu…#31
Merged
DeDuckProject merged 1 commit intomainfrom Mar 14, 2026
Merged
fix: lazy-load Playwright to prevent it leaking into check-trigger bu…#31DeDuckProject merged 1 commit intomainfrom
DeDuckProject merged 1 commit intomainfrom
Conversation
…ndle
Static imports of chromium from @playwright/test in playwright-runner.ts
and fallback.ts caused esbuild to emit require("@playwright/test") in
dist/check.js, even though check-trigger never uses Playwright.
Consumers running check-trigger without Playwright installed would hit
an ERESOLVE peer dependency conflict or runtime require failure.
Changed both imports to dynamic await import() inside the function body,
matching the existing pattern used for esbuild in config/loader.ts.
The type-only imports remain as import type (erased at compile time).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
check-triggerwas pulling inrequire("@playwright/test")even though it never uses Playwright. The root cause was a barrel file chain:esbuild marks
@playwright/testas--external, sodist/check.jsended up with a danglingrequire("@playwright/test")that fails at runtime when Playwright isn't installed. Consumers hit either a runtime error or (worse) anERESOLVEpeer dependency conflict when trying to install Playwright as a workaround.Fix
Changed static imports of
chromiuminplaywright-runner.tsandfallback.tstoawait import('@playwright/test')inside the function body — matching the existing pattern already used foresbuildinconfig/loader.ts.Type-only imports (
import type) remain static since TypeScript/esbuild erases them entirely.Verification
dist/check.jsnow has zero references to@playwright/test:Why this is the right design
check-trigger's whole purpose is to be a cheap pre-check that skips heavy dependency installation. Requiring Playwright at load time defeats that entirely.🤖 Generated with Claude Code