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.

Imports IntelliSense in monorepo works incorrectly

See original GitHub issue

Issue Type: Bug

I have TypeScript monorepo using Lerna. I have packages configured like that:

{
  "name": "@namespace/types",
  "main": "./dist/index.js",
  "source": "./src/index.ts"
}

Now, whenever I try to import something from this package in the other package VSCode proposes only imports like:

import { isNil } from "../../../packages/types/dist"

It used to work correctly and propose imports like:

import { isNil } from "@namespace/types"

I’ve tried to fix it by defining paths in the tsconfig.json and it kinda works but now I have it proposing imports like:

import { isNil } from "@namespace/types/dist"

It stopped working a few weeks ago.

VS Code version: Code 1.57.1 (507ce72a4466fbb27b715c3722558bb15afa9f48, 2021-06-17T13:28:32.912Z) OS version: Darwin x64 19.6.0 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i7-7820HQ CPU @ 2.90GHz (8 x 2900)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 16.00GB (0.47GB free)
Process Argv –crash-reporter-id 379bde90-7250-4e04-9003-abfcf19544c7
Screen Reader no
VM 0%
Extensions (25)
Extension Author (truncated) Version
cucumberautocomplete ale 2.15.1
htmltagwrap bra 0.0.7
vscode-eslint dba 2.1.23
vscode-deno den 3.7.0
vscode-new-file dku 4.0.2
eslint-disable-snippets drK 1.3.0
gitlens eam 11.5.1
prettier-vscode esb 8.0.1
vscode-jest-runner fir 0.4.44
auto-rename-tag for 0.1.6
copilot Git 1.1.1946
vscode-env Iro 0.1.0
vscode-inline-sql jtl 0.1.4
graphql-for-vscode kum 1.15.3
inline-parameters lia 0.2.1
vsliveshare ms- 1.0.4498
debugger-for-chrome msj 4.12.12
sqltools mtx 0.23.0
sass-indented rob 1.5.1
code-settings-sync Sha 3.4.3
code-spell-checker str 1.10.2
tabnine-vscode Tab 3.4.12
quokka-vscode Wal 1.0.384
local-history xyz 1.8.1
markdown-all-in-one yzh 3.4.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt700cf:30270857
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
pythonvspyt639:30300192
pythontb:30283811
vspre833:30321513
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
pythondataviewer:30285071
vscus158:30321503
pythonvsuse255:30323308
vscorehov:30309549
vscod805cf:30301675
pythonvspyt200cf:30331938
vscextlangct:30333562
binariesv615:30325510
vsccppwt:30329788
aatestflight:30331711

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kachkaevcommented, Jul 13, 2021

👋 @lukejagodzinski thanks for creating this issue! Did you have any luck with its repro by a chance?

We have a typescript monorepo with a bunch of local packages (packages/xyz a.k.a. @local/xyz). Until a few weeks ago, importing something from neighbour package suggested @local/xyz as the import path, which was great. But more recently the autocompletion changed to ../../xyz/path/to/file. Our tsconfig.json remained untouched for a few weeks, but we did bump typescript itself a few times (shortly after stable / patch releases). I can try git bisect the issue if that helps, but it might take a bit of time.

1reaction
adamsmashercommented, Oct 21, 2022

I’m curious if anyone here managed to fix this or find a around - this is still something we’re seeing here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why vscode doesn't intellisense function inside packages in ...
Inside I have two packages each package export sum function. In app1 folder I want to import this function but vscode doesn't find...
Read more >
Any idea how to make VSCode auto import work with a lerna ...
I have a lerna monorepo project with the following structure: ... how to make VSCode auto import work with a lerna-typescript-yarn monorepo?
Read more >
can't resolve es6 imports within monorepo projects : WEB-29783
if I add the import manually, webstorm does NOT complain about an error, so it does know, there is a parent node_modules, it...
Read more >
Visual Studio slows to a crawl (and crashes sometimes) with ...
By definition, a monorepo contains multiple applications and many source files. ... intellisense stops working, the errors panel reports incorrect errors, ...
Read more >
Parcel
Parcel works out of the box just as you'd expect. ... import {add} from '. ... You can even build a whole monorepo...
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