I'm encountering an issue with the npm link
command.
Here's the scenario: I have two Angular apps -
1) app-core (published locally)
2) app-main
The app-core
module has the following dependencies (installed via npm):
core
rxjs
zone
ng2-cache // Important!
etc...
The app-main
module has these dependencies:
core
rxjs
http
etc...
I've linked the app-core module to my local npm using symbolic links:
npm link
This module has been linked globally.
Now, I'm using app-core inside app-main by running:
npm link app-core
Everything seems fine so far, but when I try to build app-main, I encounter the following errors:
ERROR in ../app-core/dist/core/services/remote.service.js
Module not found: Error: Can't resolve 'ng2-cache/ng2-cache' in 'C:\Dhaval\app-core\dist\core\services'
@ ../app-core/dist/core/services/remote.service.js 14:18-48
@ ../app-core/dist/upoint.core.js
@ ./src/shared/shared.module.ts
@ ./src/app-features/app-features.module.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.
Explanation: The issue is that the ng2-cache dependency used within app-core is a custom module, creating a nesting situation where a custom module (ng2-cache) is being used inside another module (app-core), which is then used inside app-main.
This problem is causing trouble for me. Any suggestions on how to resolve it?
Your help would be greatly appreciated!