Skip to content

fix: resolve env extends from remote during bit new#9981

Merged
Jinjiang merged 5 commits into
masterfrom
fix/bit-new-extends-resolution
Sep 4, 2025
Merged

fix: resolve env extends from remote during bit new#9981
Jinjiang merged 5 commits into
masterfrom
fix/bit-new-extends-resolution

Conversation

@davidfirst
Copy link
Copy Markdown
Member

@davidfirst davidfirst commented Sep 3, 2025

Summary

Fixes the issue where bit new fails when using templates with custom envs that extend other envs.

Problem

When running bit new with a template that creates a custom env extending another env (like bitdev.vue/vue-env), the extends resolution fails with VersionNotFoundOnFS error because:

  1. The workspace being created is initially empty
  2. The base env exists only in the global scope (imported automatically)
  3. The extends resolution only looked in the local workspace

Solution

Added a fallback mechanism in workspace.ts that:

  1. Catches VersionNotFoundOnFS errors during env manifest resolution
  2. Fetches the env manifest directly from the remote component.

This approach is:

  • Lightweight: Uses existing remote component infrastructure
  • Reliable: Doesn't require complex global scope setup
  • Targeted: Only affects the specific case of extends resolution during bit new

Test Plan

Tested with:

bit new vue my-vue-workspace --env bitdev.vue/vue-env

Before: Failed with VersionNotFoundOnFS error
After: Successfully creates workspace and compiles components

The fix resolves the original extends resolution error and allows bit new to proceed successfully.

When running bit new with templates that have custom envs extending other envs,
the extends resolution would fail because the base env wasn't available in the
(empty) workspace. This adds a fallback to fetch env manifests from remote
components when they can't be found locally, enabling proper extends resolution
during workspace generation.
@Jinjiang Jinjiang merged commit f0e431c into master Sep 4, 2025
11 checks passed
@Jinjiang Jinjiang deleted the fix/bit-new-extends-resolution branch September 4, 2025 04:32
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.

3 participants