question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem in a multiple library repo: can't inter-depend on each other

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

If I create a repo made of two libraries for which one depends on the other I can’t figure out how to package the one that depends on the other. I get the error shown below.

How To Reproduce

I have a repo setup here. The libraries are in the packages folder. Note that ng-date-utils depends on ng-utils. But I get this error trying to package ng-date-utils.

cuervomovil:au-ng ken$ node_modules/.bin/ng-packagr -p packages/ng-date-utils/ng-package.json
Building Angular library
Generating bundle for @animalus/ng-date-utils
Cleaning bundle build directory
Processing assets
Running ngc

BUILD ERROR
Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/src/dateUtils.service.ts:10:27: Cannot find module '../../ng-utils/public_api'.
Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/src/module.ts:4:23: Cannot find module '../../ng-utils/public_api'.
Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/ng-date-utils.ts:7:45: Cannot find module '../ng-utils/public_api'.
Error: Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/src/dateUtils.service.ts:10:27: Cannot find module '../../ng-utils/public_api'.
Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/src/module.ts:4:23: Cannot find module '../../ng-utils/public_api'.
Error at /Users/ken/dev/animalus/au-ng/packages/ng-date-utils/.ng_pkg_build/@animalus-ng-date-utils/ts/ng-date-utils.ts:7:45: Cannot find module '../ng-utils/public_api'.
    at new UserError (/Users/ken/dev/animalus/au-ng/node_modules/ng-packagr/node_modules/@angular/tsc-wrapped/src/tsc.js:27:28)
    at check (/Users/ken/dev/animalus/au-ng/node_modules/ng-packagr/node_modules/@angular/tsc-wrapped/src/tsc.js:93:15)
    at Tsc.typeCheck (/Users/ken/dev/animalus/au-ng/node_modules/ng-packagr/node_modules/@angular/tsc-wrapped/src/tsc.js:173:9)
    at /Users/ken/dev/animalus/au-ng/node_modules/ng-packagr/node_modules/@angular/tsc-wrapped/src/main.js:122:23
    at <anonymous>

Expected Behaviour

please describe what behaviour or result you expected

Version Information

ng-packagr: v1.x.y
node: v8.x.y
@angular: v4.x.y
rxjs:
zone.js:

please include any version information that might be relevant, e.g. other third-party libraries

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
mezoistvancommented, Apr 11, 2018

Using the programmatic API, we are able to package the libraries in order, and during the packaging we are able to use the already packaged libraries. This packaging process uses a custom tsconfig that looks for the libraries in the place they are packaged to. The order of packaging is very important, as the libs with dependencies must package after the dependecies have finished packaging. Something like:

await ngPackagr()
    .forProject('/usr/local/lib-1/package.json')
    .withTsConfig('tsconfig.packagr.json')
    .build();

await ngPackagr()
    .forProject('/usr/local/lib-2-that-depends-on-lib-1/package.json')
    .withTsConfig('tsconfig.packagr.json')
    .build();

Please check the ngPackagr code for the exact API here: https://github.com/dherges/ng-packagr/blob/v2.4.1/src/lib/ng-v5/packagr.ts

2reactions
eromanocommented, Nov 22, 2017

Hi guys is possible avoid the use of link?

i find out a plugin for rollup that could avoid this thing:

https://www.npmjs.com/package/rollup-plugin-paths

but I am not sure if there is a way to include plugin in ng-packagr , someone knows if is something possible?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git Repository Structure for Interdependent Projects
The problem here is the Library Collection repository. This includes a few dozen libraries at the moment, but continues to grow at an ......
Read more >
Dependency hell - Wikipedia
The dependency issue arises when several packages have dependencies on the same shared packages or libraries, but they depend on different and incompatible ......
Read more >
How to create interdependent gems with bundler, and use ...
1 Answer 1 ... Bundler is warning you that your gems have a circular dependancy. Namely library-a depends on library-b and the other...
Read more >
Git and Project Dependencies | Atlassian Git Tutorial
Dependencies are an important aspect of software development. Allows you to manage the versions of other libraries used by your code. Read and...
Read more >
Why don't you have a monorepo? - Packt Hub
Many people conclude it must only solve problems the likes of Google and ... With each service and library being in a separate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found