Bit: Rebuild a same Angular component from different projects

Created on 25 Oct 2020  路  1Comment  路  Source: teambit/bit

Describe the bug

Is not possible to build same Angular component on different projects and export. Problem with folders and redbuild.

Steps to Reproduce

ng new example1
cd example1
ng generate component hello-world
ng generate module hello-world
# declare and export HelloWorldComponent on HelloWorldModule
bit init
bit import bit.envs/compilers/angular --compiler
bit add src/app/hello-world --main src/app/hello-world/hello-world.module.ts
bit build
bit tag --all 0.0.1
bit export pablorsk.testing hello-world
ng new example2
cd example2
bit init
bit import pablorsk.testing/hello-world
# import HelloWorldModule on AppModule (from @bit/pablorsk.testing.hello-world)
# add '<app-hello-world></app-hello-world>' to app.component.html
ng serve -o

FIRST PROBLEM: ng serve serve app ok with hello world works, but we receive warning on IDE: 'app-hello-world' is not a known element. But .

Then, we decide to modify imported component on example2 and republish.

echo "<p>more data on 0.0.2</p>" >> components/hello-world/hello-world/hello-world.component.html 
bit build
bit tag --all 0.0.2
bit export
ng serve # problem with Ivy

SECOND PROBLEM: All component code is moved from / to /hello-world. Also, __ivy_ngcc__ folder is added to code. Check 0.0.1 code vs 0.0.2 code

THIRD PROBLEM: After build, ng serve says:
This likely means that the library (@bit/pablorsk.testing.hello-world) which declares HelloWorldModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

Specifications

  • bit version : 14.8.8
  • npm version : 6.14.6
  • yarn version : 1.17.3
  • Angular CLI: 10.1.4
  • Node: 12.18.4
  • OS: linux x64
typbug

Most helpful comment

Running into the same problem with our project: https://github.com/HealthCatalyst/Fabric.Cashmere/tree/angular-9-update

>All comments

Running into the same problem with our project: https://github.com/HealthCatalyst/Fabric.Cashmere/tree/angular-9-update

Was this page helpful?
0 / 5 - 0 ratings