user2024080
user2024080

Reputation: 5099

import angular library with multiple internal projects

I have created a library using angular. now I don't want to upload the library in npm. because it's all within the company polices. in this case, after I build the library how can i share with other applications withing the organization using git repo if require.

I tried to copy and paste the build library, and one of my application, i just add in to the angular.json in script part like :

"scripts": [
   "./../xyz-library/public-api.d.ts"
]

and in app module, it trying to import like this:

import { IboLibraryModule } from '../../../xyz-library/ibo-library.d';

but getting an error as :

Cannot find module '@angular/core'.

any one help me to understand the correct approach or show me the idea to full fill my requirement?

Thanks in advance.

Upvotes: 0

Views: 148

Answers (1)

Sinandro
Sinandro

Reputation: 2666

You can install a npm package manually as long as it has a valid package.json file. For example if it's on git, they can clone it and then install the package from its file path:

git clone https://github.com/example/example-repo.git

Then install it from local path instead of npm server:

npm install ./example-repo

Upvotes: 1

Related Questions