teambit / bit-angular

Angular support for bit harmony
28 stars 3 forks source link

Cannot tag/build component when importing nested bit components #52

Closed AntGrisha closed 1 year ago

AntGrisha commented 2 years ago

Hello, thought it is probably related to bit-angular env, so writing here, instead of main bit repo.

Describe the bug

I have 3 angular bit components: spinner, n-button, n-user-verification. When I am using spinner inside n-button components are tagged successfully. But when I am trying to tag n-user-verification which uses n-button I see the following error: Appears in the NgModule.imports of NButtonModule, but could not be resolved to an NgModule class..

bit start works as expected though.

Steps to Reproduce

  1. Create 2 angular v12 components (using bit create ng-module ...)
  2. Import one component into another.
  3. Create third angularV12 bit component and import 2 components in it.

Expected Behavior

Components with nested bit components should be tagged after running bit tag

Screenshots, exceptions and logs

Screenshot of the error:

Screenshot of imported components and module:

Custom env that I use:

import * as path from 'path';
import { EnvsMain, EnvsAspect } from '@teambit/envs'
import { AngularV12Aspect, AngularV12Main } from '@teambit/angular-v12'
export class WebEnvExtension {
  constructor(private angular: AngularV12Main) {}

  static dependencies: any = [EnvsAspect, AngularV12Aspect]

  static async provider([envs, angular]: [EnvsMain, AngularV12Main]) {
    const compilerOptions = await angular.overrideCompilerOptions({
      fullTemplateTypeCheck: false,
      strictPropertyInitialization: false
    });

    const angularOptions = await angular.overrideAngularOptions({
      styles: [path.resolve('node_modules/@ntmnt/uikit.styles.core/index.scss')]
    });

    const WebEnvEnv = angular.compose([compilerOptions, angularOptions])
    envs.registerEnv(WebEnvEnv)

    return new WebEnvExtension(angular)
  }
}

Specifications

for harmony workspace

Additional context

Interesting that bit start works just fine.

AntGrisha commented 1 year ago

updated bit to 0.0.867 version and teambit.angular/versions/angular-v12 to 1.2.13, issue still reproduces

fateeand commented 1 year ago

any updates on this?

ocombe commented 1 year ago

It should be fixed with recent versions of bit and of the angular envs. If you use Angular v12 and below it might still be an issue with ngcc, but there's not much I can do on that since it's an internal issue with Angular itself and they already said that they will not fix it since ngcc is no longer required in v13+ and v12 is deprecated now. Let me know if you still have the issue after updating.