IntelliJ cannot index npm dependency from git repo

Answered

In package.json:

"devDependencies": {
"my-dependency": "git+ssh://git@github.com:MyOrg/my-dependency.git",
..
}

yarn install runs fine and installs the dependency into node_modules.

Node plugin is installed in IntelliJ and "coding assistance for Node.js" is enabled in preferences, with that dependency listed on the same preferences page.

The project itself runs fine, but

  • Click-through support is broken in the IntelliJ editor. Clicking on the component names inside import { ... } jump to the usage instances within JSX in the same file rather than to the source file in the dependency
  • the "my-dependency" text after "import { .. } from" has a green squiggly underneath which hints "Module is not installed" and the only suggestion is "run yarn install", which i've already done multiple times

This does not affect other dependencies that are properly published in npm and are referenced in package.json by their version numbers rather than a git repository url.

Clear cache and invalidate forces a re-index but doesn't help.

This seems like an indexing bug to me since anything in node_modules should be reference-able.

0
10 comments

what yarn version do you use?

0

can't reproduce;

could you share a sample project the issue can be repeated with?

your idea.log (Help > Show Log in ...) would be also helpful

0

This is an internal project and dependency so I can't share. Perhaps you can explain what are the requirements for the click-through to work? If I look at the node_modules of that dependency, i see a dist sub-directory with a minified .js file. Does IntelliJ assume any sort of structure / file / manifest / mapping is required?

0

please expand the node_modules of that dependency in Project explorer and attach a screenshot along with a package.json file of "my-dependency" package

0

This is the dependency's directory inside node_modules.

This is the behaviour mentioned when importing.

This is the redacted package.json of the dependency:

{
"name": "..",
"version": "0.1",
"description": "..",
"source": "src/index.js",
"main": "dist/index.js",
"module": "dist/index.module.js",
"unpkg": "dist/index.umd.js",
"scripts": {
"build": "rm -rf dist/ && microbundle --jsx React.createElement && rm dist/index.module.js dist/index.module.js.map",
"dev": "microbundle --jsx React.createElement --watch --compress false --raw true"
},
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/../...git"
},
"author": "..",
"license": "..",
"bugs": {
"url": ".."
},
"private": true,
"homepage": "..",
"devDependencies": {
..
},
"dependencies": {
..
}
}
0

Please could you share your idea.log (Help > Show Log in ...)? Please don't paste it here, upload it somewhere and provide a link

0

Please provide an email or place where I can securely send you the log file that is not exposed to everyone else who can see this page.

0

You can create a support ticket ( https://intellij-support.jetbrains.com/hc/en-us/requests/new?ticket_form_id=66731 ) and attach a log to it to make sure it's not disclosed

0

done @ 2523994

0

Please sign in to leave a comment.