Brahmajith Pm
Brahmajith Pm

Reputation: 43

Build error while doing lazy loading of modules

While doing lazy loading of a module in another module, getting build error. The lazy loading works fine while doing the ng serve.

Angular version :11.1.2

[error] Error: When building multiple chunks, the "output.dir" option must be used, not "output.file". To inline dynamic imports, set the "inlineDynamicImports" option.

Upvotes: 3

Views: 4121

Answers (2)

Yurii Hierts
Yurii Hierts

Reputation: 1930

As one of developers of ng-packager said: Libraries shouldn't contain any lazy-loaded module or routing. These are the responsibility of the application.

That is means you need somehow move lazy part of you library into another library, and lazy load it from application or from you library where you removed code.

https://github.com/ng-packagr/ng-packagr/issues/1960#issuecomment-827543254

Upvotes: 0

Abraham
Abraham

Reputation: 570

Please export lazy loaded modules in public-api.ts

Upvotes: 15

Related Questions