How to use Angular Library directly from Github to another Angular Project without publishing...

Discussão em 'Angular' iniciado por CRIS, Janeiro 17, 2025.

  1. CRIS

    CRIS Guest

    TL;DR - I'm looking for a solution that doesn't require publishing to NPM or using NPM symlink

    I've created two demo repos in Github, one is for the Angular Library and one for an Angular application that will use the Angular Library. I'm not allowed to publish the Angular Library to NPM due to privacy and security reasons. So I would like to npm install the Angular Library directly into the Angular application.

    I've created the Angulary Library using ng new my-lib --no-create-application and ng generate library my-lib, and the Angular application with just ng new my-app. I'm not sure how I'm going to install my-lib into my-app.

    I tried to ng build and npm pack the dist of my-lib then push everything in Github. But when I installed my-lib in my-app by putting "my-lib": "git@github.com:<github_user>/my-lib.git" in package.json and doing npm install it says that cannot find module when I try to import in my app.module.ts.

    Continue reading...

Compartilhe esta Página