Skip to content

import 'constants' always resolving to the node 'constants' module #38846

@mrlubos

Description

@mrlubos
  • VSCode Version:
Version: 1.44.2
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T17:07:18.473Z (2 wks ago)
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.3.0
  • OS Version: macOS Catalina 10.15.3 (19D76)

Steps to Reproduce:

  1. Open VSCode.
  2. Create a file src/constants.js exporting foo
  3. Import foo as import { foo } from 'constants'
  4. Hover over the constants file path.
  5. See the following.
module "constants"
@deprecated — since v6.3.0 - use constants property exposed by the relevant module instead.
  1. ⌘ + click on constants file path.
  2. See there are 2 definitions – constants.d.ts and index.d.ts but no src/constants.js

Expected result:

  • see the definition of foo from src/constants

The same issue occurs when using foo for the first time in a module, no import suggestion is shown.

My jsconfig.json file

{
  "compilerOptions": {
    "baseUrl": "./src",
    "jsx": "preserve",
    "module": "es6",
    "moduleResolution": "node",
    "target": "es6"
  },
  "exclude": [
    "**/node_modules/*",
    "coverage",
    "dist",
    "node_modules"
  ],
  "typeAcquisition": {
    "include": [
      "cypress",
      "jest"
    ]
  }
}

Does this issue occur when all extensions are disabled?: Yes/No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions