Skip to content

Find All References does not work with module.exports in JavaScript #44832

@Yohanna

Description

@Yohanna

Issue Type: Bug

  1. Create two files:

utils.js containing:

function getText() {
  return "Hello, World!";
}

module.exports = { getText };

and index.js containing:

const { getText } = require("./utils");

console.log(getText());
  1. Now go to utils.js, and try to find all references of getText, it will only show the references in the current file, utils.js, but not the reference in index.js.

Note that I've tried creating a jsconfig.json with the following contents in the root directory of the project, but it still didn't fix the problem:

{
    "compilerOptions": {
        "target": "es2020" // I also tried "ES6"
    },
    "exclude": [
        "node_modules",
        "**/node_modules/*"
    ]
}

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

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)
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) 32.00GB (9.81GB free)
Process Argv --crash-reporter-id 3be7b697-7459-484d-8019-253c76c2ed36
Screen Reader no
VM 0%
Extensions: none

Node.js version: v14.16.0

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptRescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions