3

In Angular 13 the main app compiles in .js format but when we build library with ng build, output format are .mjs files

Can we build libs to .js with ng build in Angular 13?

I'm trying to use built .mjs library as custom plugin for webpack.config.ts in my other Angular project and have many errors: unknown file format .ts etc...

The project has latest @angular 13.x setup and @angular-builders/custom-webpack 13.x

Sergsar
  • 31
  • 3
  • I am facing the same issue; because of .mjs I am getting errors in the consuming application for using require(). Any luck? – vp310 Jun 09 '22 at 14:02
  • I have removed all require imports in .mjs library and now I'm using .mjs config and plugins for web pack as workaround in my project. But it breaks typescript strong typing and couldn't been used with typescript code at all. I'm steel needed js modules compilation in Angular 13 for correct using them for webpack plugins – Sergsar Jun 14 '22 at 13:48

0 Answers0