1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

npm link is not working with angular-cli created projects

Discussão em 'Angular' iniciado por Code Guru, Maio 23, 2025.

  1. Code Guru

    Code Guru Guest

    I have created a project using angular-cli. There is one AppModule and AppComponent I want to use this AppModule and its components (AppComponent) in other angular apps. So I have created index.ts file and exported the AppModule and AppComponent

    export {AppModule} from './src/app/app.module';
    export {AppComponent} from './src/app/app.component';


    Then created local linking using npm link and a link is created with the name defined in package.json.

    Now In other project where I want to use this exported module run the

    npm link project-name


    Linking has been done successfully. I tried

    import { AppModule as AModule} from 'my-components';


    But this is not working as webpack gets failed to compiles AppModule file as the reference is not getting resolved. In SystemJs We defined the mapping of this in systemjs.config.js file but there is no config file.

    How can I solve this?

    Is there any other method to reuse local modules?

    Continue reading...

Compartilhe esta Página