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.

incorrect paths for import statement is generated

See original GitHub issue

Type of Issue

[x] Bug Report
[ ] Feature Request

Description

incorrect paths for import statement can be generated when a project has multiple library workspaces.

I think the following issue is similar to this issue. https://github.com/ng-packagr/ng-packagr/issues/1109

How To Reproduce

I created a repository for reproduce this bug.

  1. git clone https://github.com/musou1500/test-angular-workspace
  2. ng build lib2 && ng build lib1
  3. open dist/lib1/lib/lib1.service.d.ts. then you can see an incorrect path for import on Lib1Service.test method.
    // should be ../../../dist/lib2/lib2
    test(): import("../../../../dist/lib2/lib2").Entity;

Expected Behaviour

the correct path for import statements should be generated.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr:            5.5.1
@angular/compiler:     8.2.7
rollup:                1.21.4
tsickle:               0.36.0
typescript:            3.5.3

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:8

github_iconTop GitHub Comments

5reactions
damienwebdevcommented, Oct 22, 2019

See this as well for builds of https://github.com/graycoreio/daffodil. I was able to work around it by directly referencing the type in the child library. This appears to only happen for inferred types.

4reactions
plchampignycommented, Oct 12, 2019

We had a similar issue yesterday. Was using a sibling library in a library using it’s alias name “@somename/some-library” and imports were being transformed to relative paths. This was causing usage issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript path resulting in wrong import - Stack Overflow
compilerOptions.baseUrl is being prefixed to path specified in import statement to create path relative to the location of tsconfig.json ...
Read more >
Configuring the Style of Imports in JavaScript and TypeScript
Find out how to configure the style of imports that are added in the project to make sure everything looks just right.
Read more >
Import Statements | Qt QML 6.4.1
An import statement allows clients to tell the engine which modules, JavaScript resources and component directories are used within a QML document.
Read more >
Chapter 8 – Reading and Writing Files
Since os.path is a module inside the os module, you can import it by simply ... True if the argument is an absolute...
Read more >
Absolute vs Relative Imports in Python
How Imports Work; Syntax of Import Statements; Styling of Import Statements ... Python then searches for it in a list of directories defined...
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