Core module subpaths are not supported
See original GitHub issueTrying to use import modules that specify a subpath aren’t supported and I haven’t been able to find a way to work around it.
Error:
Unable to resolve path to module ‘path/posix’. eslint(import/no-unresolved)
Example:
import { join, parse, relative } from 'path/posix';
import { readFile, writeFile } from 'fs/promises';
I tried the following with this plugin to no avail:
"rules": {
"import/no-unresolved": ["error", {
"ignore": ["path/posix", "path\/posix", "path\\/posix"]
}],
},
"settings": {
"import/core-modules": ["path/posix", "path\/posix", "path\\/posix"]
}
Similarly, this problem exists with node/no-missing-import
but I can use the following workaround:
"node/no-missing-import": ["error", {
"allowModules": ["path/posix"]
}]
Issue Analytics
- State:
- Created 3 years ago
- Comments:25 (10 by maintainers)
Top Results From Across the Web
Issues - GitHub
When migrating to cdk 2.1.0, i have the following error: Error: Package subpath './core' is not defined by "exports" in /.
Read more >Ask Question - Stack Overflow
I was receiving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/parser' is not defined by "exports" in ...
Read more >Modules: Packages | Node.js v19.3.0 Documentation
When the "exports" field is defined, all subpaths of the package are encapsulated and no longer available to importers. For example, require('pkg/subpath.js') ...
Read more >Dependency resolution - Parcel
As Parcel builds your source code, it discovers dependencies, which allow code to be broken into separate files and reused in multiple places....
Read more >How Jotai Specifies Package Entry Points - Daishi Kato's blog
With “exports”, we can export subpath entry points along with main entry point. We want to support both CJS and ESM, and conditional...
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 Free
Top 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
For anyone that finds this still. VSCode still ships with v12 Node where fs/promises is not available.
You can solve this by adding the following VSCode setting, to use your system node.
https://github.com/microsoft/vscode-eslint/issues/1097
@ljharb I am getting it both in the terminal running
eslint
as well as in VS Code. Let me try to track down what the real fault is then.