Using own package name in import statement causes missing dependency error
See original GitHub issueBug Description
Let’s assume I have a package my-awesome-package
with the following structure:
|-package.json
|+foo
|+bar
|-index.js
|-constants.js
So, in my index.js I’d like to use some constants, but for some reason instead of doing
import { PI } from "../../constants";
I prefer to use
import { PI } from "my-awesome-package/constants";
So when I run depcheck it throws a missing dependency error
Versions
node -v
: v8.11.4npm -v
: 5.6.0depcheck -v
: 0.6.1
Extra info
I’m not quite sure about how cool using import statements containing own package name is, but it looks ok for me
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Intellij Cannot resolve symbol on import - java - Stack Overflow
There can be multiple reasons for this. In my case it was wrong source root issue. Invalidate caches didn't work along with other...
Read more >report-missing-dependencies - NPM Package Overview - Socket
Reports an error if a package (e.g. import {xx} from "my-package" ) is used in the src folder but not defined in the...
Read more >Missing Dependencies after Importing Object Manager ...
Select “Proceed” and name the Undo package when prompted. ... Users encounter error regarding missing dependency. CAUSE:
Read more >Running mypy and managing imports
When mypy encounters an import statement or receives module names from the command line via the --module or --package flags, mypy tries to...
Read more >eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
With Node 16 self reference are supported https://nodejs.org/api/packages.html#self-referencing-a-package-using-its-name, I’m wondering how to handle this with
depcheck
nowI fully agree with @phil-lgr. This should not cause a missing dependency issue in case the package defines “exports” in the
package.json
.