Important : the external third library is published on a public NPM repository. It is very annoying because it means we need to publish a new version on the repository every time we do a change, even if it is a very small one. We should look for a better solution, but it is another topic.
The configuration with Angular 11:
"my-external-third-library":
"version": "1.0"
"peerDependencies":
"@angular/core": "~11.2.14",
"ngx-filesaver": "^11.0.0",
"ngx-toastr": "^13.1.0",
"my-project"
"version": "1.0"
"dependencies":
"@angular/core": "~11.2.14",
"my-external-third-library": "1.0",
"ngx-filesaver": "^11.0.0",
"ngx-toastr": "^13.1.0",
npm i
command is okng serve
command is ok
The configuration with Angular 12:
"my-external-third-library":
"version": "1.1"
"peerDependencies":
"@angular/core": "~12.2.17",
"ngx-filesaver": "^12.0.0",
"ngx-toastr": "^14.3.0",
"my-project"
"version": "1.1"
"dependencies":
"@angular/core": "~12.2.17",
"my-external-third-library": "1.1",
"ngx-filesaver": "^12.0.0",
"ngx-toastr": "^14.3.0",
npm i
command is okng serve
command fails:
C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40
throw new Error("The target entry-point \"" + invalidTarget.entryPoint.name + "\" has missing dependencies:\n" +
^
Error: The target entry-point "my-external-third-library" has missing dependencies:
- ngx-toastr/public_api
- ngx-filesaver/index
at TargetedEntryPointFinder.findEntryPoints (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\targeted_entry_point_finder.js:40:23)
at C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\execution\analyze_entry_points.js:29:41
at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:28:29)
at C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:59
at SyncLocker.lock (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\locking\sync_locker.js:34:24)
at SingleProcessExecutorSync.execute (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\execution\single_process_executor.js:57:27)
at Object.mainNgcc (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\src\main.js:74:25)
at Object.process (C:\Users\my-path\node_modules\@angular\compiler-cli\ngcc\index.js:29:23)
at NgccProcessor.processModule (C:\Users\my-path\node_modules\@ngtools\webpack\src\ngcc_processor.js:175:16)
at C:\Users\my-path\node_modules\@ngtools\webpack\src\ivy\host.js:146:18
Any idea of what's wrong ? I am stuck with it...
An interesting point is what we see for ngx-filesaver
and ngx-toastr
libraries in the node_modules
folder:
For Angular 11:
"ngx-filesaver": "^11.0.0"
ngx-filesaver.d.ts:
/**
* Generated bundle index. Do not edit.
*/
export * from './index';
"ngx-toastr": "^13.1.0"
ngx-toastr.d.ts:
/**
* Generated bundle index. Do not edit.
*/
export * from './public_api';
For Angular 12:
"ngx-filesaver": "^12.0.0"
ngx-filesaver.d.ts:
/**
* Generated bundle index. Do not edit.
*/
/// <amd-module name="ngx-filesaver" />
export * from './index';
"ngx-toastr": "^14.3.0"
ngx-toastr.d.ts:
/**
* Generated bundle index. Do not edit.
*/
/// <amd-module name="ngx-toastr" />
export * from './public_api';
Note the /// <amd-module name="ngx-toastr" />
line that is added with Angular 12. Among all the libraries installed in the node_modules
folder of the external third library, that line only exists for the two libraries that cause the issue.
I tried to remove the node_modules
folder and re-run npm i
: it didn't change anything.