Skip to content

Only add package.json to the bundle when in Dev - #827

Closed
wouterlucas wants to merge 1 commit into
masterfrom
dev-only-version-logging
Closed

wouterlucas wants to merge 1 commit into
masterfrom
dev-only-version-logging

Conversation

@wouterlucas

Copy link
Copy Markdown
Contributor

Removes the static package.json import from src/launch.js so prod bundles no longer inline the full package.json.

Blits/renderer versions are now resolved via dynamic JSON imports inside logVersionsDev(), called only when __DEV__ is true. Prod skips the extra renderer package fetch and the Log.info calls on the launch path.

Notes:

  • node --check src/launch.js exits 0, but full lint/test runners OOM in this environment (pre-existing, also on unmodified files) — needs CI.
  • Cross-checked against PR Add FTL-inspired AGENTS.md for Blits #741 (AGENTS.md): boundary-only logging, explicit === true guards, arrow helper, no codegen/symbols changes.
  • Worth verifying prod dist contains no package.json snippet (Rollup DCE of the dev-only branch).

@github-actions

Copy link
Copy Markdown

Test Results: ✅ PASSED

Run at: 2026-10-28T20:54:36.754Z

Summary:
passed: 1591 failed: 0 of 1591 tests

Remove static package.json import so prod bundles skip the full
package.json. Resolve Blits/renderer versions via dynamic JSON imports
only when __DEV__ is true, avoiding the extra renderer package fetch
and Log.info calls on the launch path in production.
@wouterlucas wouterlucas changed the title Guard version logging behind dev-only mode Only add package.json to the bundle when in Dev Oct 28, 2026
@github-actions

Copy link
Copy Markdown

Benchmark comparison

Timing Change
Synchronous generation +0.26%
Total time to idle -0.93%

Negative means faster. Informational results; small changes can be measurement noise.

Full report · Workflow run

Head: 45311f4079c4 · Base: 2a255a530a26

@michielvandergeest

Copy link
Copy Markdown
Collaborator

Thanks for this PR and flagging the fact that package.json is included in the bundle just to be able to log the versions of Blits and renderer

I've taken a slightly different approach here, using a vite plugin: #829
This allows us to keep the logging in prod version as well, means we never have to include the package.json in the bundle and makes the version detection more robust (also for local installs)

Closing this PR in favour of #829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants