Angular2: Dependencies Between Apps created with angular-cli

独自空忆成欢 提交于 2019-12-07 02:55:28

In your src/app/mysecondapp.component.ts, try to replace :

import { MyFirstAppService } from 'MyFirstApp';

By this

import { MyFirstAppService } from './app/MyFirstApp';

I hope it'll work :)

Developers of the Angular2-cli project want to support library/addons flavoured project for the 1.0.0 release.

For now, what we can do to make it works:

  1. Add a main in the library package.json
  2. npm install yourlib --save in your other apps
  3. Configure your second app so it packages your lib according to your needs. An example with gulp:

    var copyScripts = require('ionic-gulp-scripts-copy');

    gulp.task('assets', function(){
      return copyScripts({src:'node_modules/your-lib/dist/**/*', dest:'our-dest'});
    });
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!