[go: nahoru, domu]

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

npm imports don't work in repl #16088

Closed
oscarotero opened this issue Sep 29, 2022 · 5 comments · Fixed by #16770
Closed

npm imports don't work in repl #16088

oscarotero opened this issue Sep 29, 2022 · 5 comments · Fixed by #16770

Comments

@oscarotero
Copy link

When I want to import a npm module dynamically, I get the following error:

const react = await import("npm:react");

// Uncaught TypeError: Loading unprepared module: npm:react
//     at async <anonymous>:2:15
@dsherret
Copy link
Member
dsherret commented Sep 29, 2022

Works for me. Can you provide some reproduction steps? Maybe this is #15826?

@dsherret dsherret added needs info needs further information to be properly triaged node compat labels Sep 29, 2022
@oscarotero
Copy link
Author

The example above fails in repl:
imaxe

but it works if it's in a file.

Other weird examples:

// This works
const react = await import("npm:react");

// This doesn't work
const react = await import(`npm:react`);

// This doesn't work
const react = await import("npm:" + "react");

Other example, not sure if it's a bug:

// error: Uncaught (in promise) Error: Cannot find module 'react'
const server = await import("npm:react-dom@18.2.0/server");
// This works
const react = await import("npm:react");
const dom = await import("npm:react-dom@18.2.0/server");

@dsherret dsherret changed the title Dynamic npm imports don't work npm imports don't work in repl Sep 30, 2022
@dsherret dsherret added enhancement and removed needs info needs further information to be properly triaged labels Sep 30, 2022
@dsherret dsherret mentioned this issue Sep 30, 2022
25 tasks
@dsherret
Copy link
Member

We haven't implemented npm specifiers in the repl yet. I've renamed this issue and added it to the roadmap.

The non-analyzable specifiers example is probably #15826 and the react-dom one is peer dependency support, which we don't have yet either.

@oscarotero
Copy link
Author

okay, thx

@rojvv
Copy link
Contributor
rojvv commented Nov 14, 2022

Would be cool.

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

Successfully merging a pull request may close this issue.

3 participants