Why does Angular warn that my imports within a project are CommonJS or AMD dependencies

Viewed 224

In my Angular 13 project, when I make a change, sometimes the recompilation is very fast (3-5s) other times, it takes multiple minutes (100-200s).

When the build is slow, I usually see an error like this:

Warning: .../my-project/src/app/some-thing/some-thing.component.ts depends on 'src/app/util/some-utility'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

The thing is, the imports are always internal, using ES modules. Why is Angular complaining that this is a CommonJS or AMD dependency? Are there certain conditions under which TS files in project are treated as CommonJS or AMD?

Most people seeing these warnings are using an external library like RxJS or lodash. All of the warnings I'm seeing are within the project itself.

0 Answers
Related