Bit: Incorect angular 9 build

Created on 3 Sep 2020  路  4Comments  路  Source: teambit/bit

Describe the bug

Currently the angular compiler does something strange when exporting the decorators:

 AlertModule.decorators = [
    { type: NgModule, args: [{
        declarations: [AlertComponent],
        imports: [
          CommonModule
        ],
        exports: [AlertComponent],
      },] }
  ];

When it should do:

 AlertModule = __decorate([
    NgModule({
      declarations: [AlertComponent],
      imports: [
        CommonModule
      ],
      exports: [AlertComponent]
    })
  ], AlertModule);
// INFO: __decorate comes from 'tslib'

So on my side, following the angular tutorial, when importing the component in an angular project is not working.

Specifications

  • Bit version: 14.8.8
  • Bit compiler (include version): bit.envs/compilers/[email protected]
arebuild typbug

All 4 comments

If it may helps: I get a Value at position X in the NgModule.imports of AppModule is not a reference. Ivy is enabled, and I'm using Angular 9.
When Ivy is disabled: ERROR in Unexpected value 'BitDevTestModule in [path] imported by the module 'AppModule in [path] . Please add a @NgModule annotation.

Actually, after further investigations, the angular tutorial doesn't work at all for angular 9+. But works fine only with angular 8

Found a workaround: import { AlertModule } from '@bit/[name].[collection].alert/dist'; Note that I must append /dist at the end to make it work properly

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KutnerUri picture KutnerUri  路  3Comments

manuel-minniti picture manuel-minniti  路  3Comments

williamluke4 picture williamluke4  路  4Comments

odedre picture odedre  路  3Comments

JamesNorris11 picture JamesNorris11  路  4Comments