Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno check fails to read package.json ./* export mappings #20513

Closed
marvinhagemeister opened this issue Sep 15, 2023 · 3 comments
Closed

deno check fails to read package.json ./* export mappings #20513

marvinhagemeister opened this issue Sep 15, 2023 · 3 comments
Labels
bug Something isn't working correctly important for fresh

Comments

@marvinhagemeister
Copy link
Contributor

It looks like the deno check command isn't able to deal with wildcard mappings in package.json#exports.

# (formatted for readability)
error: Uncaught Error: Failed resolving package config for 'npm:puppeteer@20.8.3/install.js':
  [ERR_INVALID_PACKAGE_TARGET] Invalid "exports" target {"import":"./*","require":"./*"} defined for './*' in the package config
   /Users/marvinh/Library/Caches/deno/npm/registry.npmjs.org/puppeteer/20.8.3/package.json imported from
   file:///Users/marvinh/Library/Caches/deno/npm/registry.npmjs.org/puppeteer/20.8.3/; target must start with "./"

Steps to reproduce

  1. Create a file foo.ts with the following content:
import * as install from "npm:puppeteer/install.js";
console.log(install);
  1. Run deno check -A foo.ts
@marvinhagemeister marvinhagemeister added the bug Something isn't working correctly label Sep 15, 2023
@zhmushan
Copy link
Contributor

deno/ext/node/resolution.rs

Lines 836 to 840 in b9b4ad3

if mode.is_types() {
self.path_to_declaration_path(path, referrer_kind)
} else {
Some(path)
}

The resolution process has got the JS file path, but for the purpose of type checking, it attempts to locate the corresponding d.ts file.
Perhaps we can consider degrading it to the original file path when the d.ts file does not exist?

@tv42
Copy link

tv42 commented Oct 25, 2023

This might be duplicate of #19666.

@bartlomieju
Copy link
Member

Works fine in Deno 2.1.2 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly important for fresh
Projects
None yet
Development

No branches or pull requests

4 participants