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.

Can references path support package name?

See original GitHub issue


🔍 Search Terms

projectReference, reference path, package name

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn’t be a breaking change in existing TypeScript/JavaScript code
  • This wouldn’t change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn’t a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript’s Design Goals.

⭐ Suggestion

add package name path support in tsconfig references path

📃 Motivating Example

originally, when we use project in a complex repo, path config can be nasty that only relative path is supported. so we have config like blow in our tsconfig.json.

"references": [
    { "path": "../libs/pkg-a" },
    { "path": "../../../libraries/pkg-b" },
    { "path": "../../../libraries/pkg-c/" }

This is hard to trace the referenced config path, and also leads extra job when moving this package around in the repo. After implementation of package name support, above config can be simplified to

"references": [
    { "path": "@some/pkg-a" },
    { "path": "@some-other/pkg-b" },
    { "path": "@some-other/pkg-c/" }

💻 Use Cases

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

m1hengcommented, Jun 25, 2021

I think maybe adding a module path resolving logic in would solve my problem.

swandircommented, Jan 17, 2022

Filenames are already assumed to be relative to the directory containing the tsconfig, so we’d need to have some different syntax, but it’s conceivable.

Perhaps a new key?

  "references": [
    { "module": "@scope/name/subpath" }
Read more comments on GitHub >

github_iconTop Results From Across the Web

PackageReference in project files - NuGet - Microsoft Learn
In this article. Package references, using <PackageReference> MSBuild items, specify NuGet package dependencies directly within project files, ...
Read more >
Package name does not correspond to the file path - IntelliJ
Package name does not correspond to the file path - IntelliJ - Stack Overflow. Stack Overflow for Teams – Start collaborating and sharing ......
Read more >
With project references, some cross-package imports ... - GitHub
With project references, some cross-package imports of inferred types are emitted with relative paths #39117.
Read more >
Documentation - Project References - TypeScript
The path property of each reference can point to a directory containing a tsconfig.json file, or to the config file itself (which may...
Read more >
What are PackageReferences and how will they help optimise ...
PackageReference is a new way to allow NuGet to manage your projects references. Before this, adding a NuGet package would update both the ......
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 Post

No results found

github_iconTop Related Hashnode Post

No results found