-
Notifications
You must be signed in to change notification settings - Fork 942
feat: implement esbuild bundling for Bit CLI with ESM support #10000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
davidfirst
wants to merge
131
commits into
master
Choose a base branch
from
bit-bundle2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
… use that require aspect func in load bit
# Conflicts: # scopes/harmony/bit/manifests.ts
# Conflicts: # scopes/harmony/bit/load-bit.ts # scopes/harmony/bit/manifests.ts
# Conflicts: # scopes/harmony/bit/manifests.ts
# Conflicts: # .gitignore # package.json # scopes/harmony/bit/app.ts # scopes/harmony/bit/bootstrap.ts # scopes/harmony/bit/load-bit.ts # scopes/harmony/cli/cli-parser.ts # scopes/harmony/config/config.main.runtime.ts # scopes/react/react-native/react-native.main.runtime.ts # scopes/react/react/jest/jest.base.config.js # scopes/react/react/jest/jest.cjs.config.js
Fix path resolution for @teambit packages that have problematic exports adding .ts extension. Use createRequire from working directory and check for files with common extensions to avoid resolution errors.
- Keep bundling-specific logic in app.ts for bundle functionality - Update manifests.ts to latest version from master with all new aspects - Preserve esbuild dependencies and bundle script in package.json - Use master versions for improved type imports and path resolution - Maintain bundling output directory in gitignore
- Convert manifestsMap to function for bundling hoisting support - Use explicit aspect paths (.aspect) for all imports in manifests.ts - Comment out requireAspects calls (incompatible with bundled environment) - Comment out yargs import in cli-parser (bundling issue) - Use regular import for SchemaExtractor (not just type) - Remove ObjectsAspect (package doesn't exist) - Fix VueAspect import path to vue.aspect - Maintain original pattern: const manifestsMap = getManifestsMap() at top
Add esm.mjs files to components that use node-babel-mocha env to support ESM imports when components are imported in bundled environment.
- Add config-store, version-history, ci, and cli-mcp-server aspects to core-aspects-ids.ts - Update core-aspects-exports.ts with corresponding exports - Ensures all recent core aspects are included in esbuild bundle generation
- Add esm.mjs files for config-store, ci, and cli-mcp-server aspects - Enables proper ESM module resolution during bundle generation - Fixes esbuild errors for missing esm.mjs files
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
This PR implements esbuild-based bundling for the Bit CLI, continuing the work from #7180. The bundled version provides faster startup times and simplified deployment while maintaining full compatibility with Bit's component system.
Key Changes
Performance Comparison
Key Takeaways
Testing
Bundle builds successfully and runs without errors:
Related Work
Continuation of #7180
This implementation builds upon Gilad's original bundling work, bringing it up to date with current master and resolving compatibility issues that arose from recent ESM adoption across the codebase.