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 with npm: import: Invalid "exports" target; target must start with "./" #19666

Closed
not-my-profile opened this issue Jun 30, 2023 · 2 comments

Comments

@not-my-profile
Copy link
Contributor

import renderMathEl from 'npm:katex@0.16.7/contrib/auto-render';

When checked with deno check I get the following error message:

error: Uncaught Error: Error resolving package config for 'npm:katex@0.16.7/contrib/auto-render': [ERR_INVALID_PACKAGE_TARGET] Invalid "exports" target {"require":"./dist/contrib/auto-render.js","import":"./dist/contrib/auto-render.mjs"} defined for './contrib/auto-render' in the package config /home/martin/.cache/deno/npm/registry.npmjs.org/katex/0.16.7/package.json imported from file:///home/martin/.cache/deno/npm/registry.npmjs.org/katex/0.16.7/; target must start with "./"
at (ext:deno_tsc/99_main_compiler.js:600:28)

(using the latest deno 1.34.3)

@not-my-profile not-my-profile changed the title npm: import fails to check: Invalid "exports" target; target must start with "./" deno check fails with npm: import: Invalid "exports" target; target must start with "./" Jun 30, 2023
@tv42
Copy link

tv42 commented Oct 25, 2023

This also triggers with react-dom:

$ echo 'import ReactDOMServer from "npm:react-dom@18.2.0/server";' >foo.ts
$ deno check ./foo.ts
Check file:///home/tv/tmp/z/foo.ts
error: Uncaught Error: Error resolving package config for 'npm:react-dom@18.2.0/server': [ERR_INVALID_PACKAGE_TARGET] Invalid "exports" target {"deno":"./server.browser.js","worker":"./server.browser.js","browser":"./server.browser.js","default":"./server.node.js"} defined for './server' in the package config /home/tv/.cache/deno/npm/registry.npmjs.org/react-dom/18.2.0/package.json imported from file:///home/tv/.cache/deno/npm/registry.npmjs.org/react-dom/18.2.0/; target must start with "./"
    at <anonymous> (ext:deno_tsc/99_main_compiler.js:600:28)

@bartlomieju
Copy link
Member

I just tried it on Deno v2.1.2 and it works fine 👍 gonna close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants