fix: do not inline package.json into coreBundle#40093
Merged
yury-s merged 1 commit intomicrosoft:mainfrom Apr 7, 2026
Merged
Conversation
pavelfeldman
approved these changes
Apr 7, 2026
esbuild was statically resolving `require('../package.json')` in
package.ts and inlining the JSON contents into the bundled
coreBundle.js. This froze the source `1.x.0-next` version into the
bundle, diverging from the published version that the on-disk
package.json carries after release tagging.
The mismatch broke playwright-cli's daemon protocol: the daemon (loaded
from coreBundle.js) wrote sessions with version `1.x.0-next`, while the
client (loaded from the standalone lib/package.js) reported the
published version like `1.60.0-alpha-2026-04-07`. The semver
compatibility check then rejected every command with "Client is vX,
session is v1.x.0-next".
Use a runtime-computed path so esbuild cannot statically analyze the
require, matching the pattern already used for api.json and help.json
elsewhere in the codebase.
2bfdd34 to
8c8010d
Compare
Contributor
Test results for "MCP"6442 passed, 383 skipped Merge workflow run. |
Contributor
Test results for "tests 1"1 failed 5 flaky39141 passed, 846 skipped Merge workflow run. |
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.
Summary
packages/playwright-core/src/package.tsdoesrequire('../package.json'). esbuild statically resolves this when bundlingcoreBundle.tsand inlines the JSON contents (with the source1.x.0-nextversion) intolib/coreBundle.js. After release tagging the on-diskpackage.jsoncarries the published version, but the bundle still reports1.x.0-next.This breaks playwright-cli's daemon protocol. The daemon (which loads
coreBundle.js) writes session files withversion: "1.x.0-next", while the client (which loads the standalonelib/package.js) reports the published version like1.60.0-alpha-2026-04-07. The semver compatibility check intools/cli-client/session.tsthen rejects every command with:The bug was introduced in #40074, which was the first change to ship a pre-built
coreBundle.jsto npm.Fix
Use a runtime-computed path so esbuild cannot statically analyze the require, matching the pattern already used for
api.jsonandhelp.jsonelsewhere in the codebase (require(libPath(...)),require(path.join(packageRoot, ...))).