Search code examples
buildangular-cliangular8aot

Angular build with --aot fails with 'ɵbl' (imported as 'i1') was not found


My Angular 8 application works just fine with ng serve.

However, with ng build --prod --aot=true, I get the following error during compilation :

"export 'ɵbl' (imported as 'i1') was not found in 'my-library'

It seems like there's a bug with with the --aot flag, as it successfully compiles without it.

How can I find what is wrong with my-library ?


Solution

  • When building with --aot, these errors can show up when the library is not statically analyzable for AoT.

    There are some gotchas that you can check in my-library to make sure it is compliant with AoT.

    However this might not be the case as your error is very much opaque : try adding the --optimization=false flag to disable compression and hopefully get more details about the error :

    ng build --prod --aot=true --optimization=false
    

    Your error message could then become clearer.