1

In my angular project, I am using this library "@types/uuid": "^8.3.0", and I am getting a warning that says Warning:

../name.component.ts depends on 'uuid'. CommonJS or AMD dependencies can cause optimization bailouts.

I read about the problem and I understood that I should not use CommonJS as it increases the bundle size but instead I should use ecmascript. I wanted to replace it now but I could not find any replacment. Does anyone have a solution for this problem ?

BTW, I have seen this question (Upgrading to Angular 10 - Fix CommonJS or AMD dependencies can cause optimization bailouts) but it is specific to rxjs. I would like to know the solution in general or at least for the uuid library

Ahmed
  • 595
  • 4
  • 25
  • https://angular.io/guide/build#configuring-commonjs-dependencies – R. Richards Dec 31 '20 at 16:37
  • Does this answer your question? [Upgrading to Angular 10 - Fix CommonJS or AMD dependencies can cause optimization bailouts](https://stackoverflow.com/questions/62592903/upgrading-to-angular-10-fix-commonjs-or-amd-dependencies-can-cause-optimizatio/62604034#62604034) – R. Richards Dec 31 '20 at 16:37
  • The solution there is specific to rxjs, I would like the solution for the library in the question @R.Richards – Ahmed Dec 31 '20 at 17:03
  • Replace `rxjs-compat` with `@types/uuid` in the answer. Done. – R. Richards Dec 31 '20 at 17:05
  • Where exactly do you meen? – Ahmed Dec 31 '20 at 17:06
  • In your angular.json. See this: https://angular.io/guide/build#configuring-commonjs-dependencies – R. Richards Dec 31 '20 at 17:07
  • 4
    That is simply ignoring the error. I want a solution for the warning not ignoring it. – Ahmed Dec 31 '20 at 17:19
  • That sounds like a question for library/module recommendation. That's off topic. Your problem is a CommonJS module and the solution is to replace it with a different module. – Thomas Sablik Dec 31 '20 at 17:28
  • 4
    Well, I am asking about a solution which could be a recommendation!! You say the solution is to replace it with a different module. I am asking about that different module. – Ahmed Dec 31 '20 at 17:40

0 Answers0