Skip to content

Conversation

@davidfirst
Copy link
Member

Summary

Fixes an issue where component dependencies were not installed during bit import if their dependency detection hadn't completed before the install manifest was generated. This primarily affected Vue SFC files and other file types with delayed dependency analysis.

Problem

When running bit import learnbit-vue.graphql/user-app, the component @learnbit-vue/graphql.composables.user was not installed even though it was a dependency in the model. Running bit status showed it as missing, and a second bit install was required to install it.

Root Cause

The issue occurred because:

  1. During import, component files were written to disk
  2. Install was triggered immediately
  3. Dependency detection for Vue SFC files hadn't completed yet
  4. The dependency wasn't in the "missing packages" list
  5. Model dependencies were filtered to only include missing packages
  6. Installation proceeded without the component dependency

Solution

Two changes were made:

  1. Component Writer (scopes/component/component-writer/component-writer.main.runtime.ts):

    • Clear component cache and explicitly load imported components before install
    • This triggers full dependency detection before manifest generation
  2. Dependency List Factory (scopes/dependencies/dependency-resolver/dependencies/dependency-list-factory.ts):

    • Modified logic to always include component dependencies from the model when analyzing dependencies
    • Component dependencies are now added even if not yet detected as "missing"
    • Package dependencies still filtered by missing packages list to respect user changes

Testing

Verified the fix by:

  • Running bit import learnbit-vue.graphql/user-app in a fresh workspace
  • Confirming @learnbit-vue/graphql.composables.user is installed on first import
  • Running bit status shows no issues
  • No need to run bit install again

Impact

  • Fixes newly imported components missing component dependencies
  • Ensures install after import works correctly for all file types
  • Safe change: only affects newly imported components during install

Component dependencies from the model are now included during install even if
dependency detection hasn't fully completed. This fixes an issue where Vue SFC
and other file types with delayed dependency detection would result in missing
component dependencies after import.

The fix ensures newly imported components load fully before install to trigger
dependency detection, and component dependencies from the model are always
included when the component is being analyzed for missing packages.

Fixes an issue where @learnbit-vue/graphql.composables.user was not installed
during 'bit import learnbit-vue.graphql/user-app' but was detected as missing
in 'bit status' and required running 'bit install' again.
@davidfirst davidfirst marked this pull request as draft November 24, 2025 22:12
@davidfirst
Copy link
Member Author

Here is the issue with this approach: this fix includes ALL component dependencies from the model whenever ANY dependency is missing. This doesn't respect if a user actually removed a dependency from the source code.

See #10095 for a different approach to fix it.

@davidfirst davidfirst closed this Nov 25, 2025
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