Repository navigation
fix(bundlecheck): auto-detect node platform for packages using Node.js built-in modules - #537
Merged
aversini merged 3 commits intoMar 25, 2026
Conversation
…s built-in modules When esbuild fails to resolve Node.js built-ins (path, fs, http, etc.) during browser bundling, automatically retry with platform: "node". This fixes packages like @docmd/core that don't declare engines.node but use Node.js APIs. Also handles native .node addon files (e.g., fsevents) by treating them as empty during bundling, and stores the actual detected platform in the cache so cached results display the correct platform. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves bundlecheck’s platform detection by retrying failed browser bundles as Node bundles when esbuild errors indicate Node.js built-in usage, and updates caching so results reflect the actual detected platform.
Changes:
- Auto-retry bundling with
platform: "node"when unresolved modules are recognized as Node.js built-ins - Treat native
.nodeaddons as empty during bundling to avoid esbuild loader failures - Add
actual_platformto cache schema and hydrate cached results with the real platform
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/bundlecheck/src/cache.ts | Adds actual_platform column + logic to read/write actual detected platform in cache |
| packages/bundlecheck/src/bundler.ts | Adds Node built-in detection + retry to node; treats .node addons as empty |
| packages/bundlecheck/src/tests/bundler.test.ts | Adds unit tests covering node built-in auto-retry and “explicit browser platform” behavior |
| .claude/skills/tdd | Adds Claude tooling skill indirection file |
| .claude/settings.json | Adds Claude Code settings/permissions configuration |
| .claude/commands/branch.md | Adds a Claude workflow command document |
Split on "/" and check the root segment so that imports like "fs/promises" or "node:path/posix" are correctly identified as Node.js built-ins. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
aversini
deleted the
fix_bundlecheck_auto_detect_node_platform_for_packages_using_nodejs_builtin_modules
branch
March 25, 2026 22:06
Merged
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
platform: "node"when esbuild fails to resolve Node.js built-in modules (path,fs,http, etc.) during browser bundling.nodeaddon files (e.g.,fsevents) by treating them as empty during bundlingFixes packages like
@docmd/corethat don't declareengines.nodein theirpackage.jsonbut use Node.js APIs — these were incorrectly bundled as browser packages, causing build failures.Test plan
--platform browserstill errors on Node.js built-insbundlecheck "@docmd/core"succeeds and showsnode (auto-detected)node (auto-detected)🤖 Generated with Claude Code