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

Using imports from external packages #5

Open
aurelien-boubennec opened this issue Aug 9, 2024 · 1 comment
Open

Using imports from external packages #5

aurelien-boubennec opened this issue Aug 9, 2024 · 1 comment

Comments

@aurelien-boubennec
Copy link

Hi,

When I test this code in a React web app:

import { threaded } from "multithreading";

const getId = threaded(async function* () {
  const { v4 } = yield "uuid"; // Import other package

  return v4();
}

console.log(await getId()); // 1a107623-3052-4f61-aca9-9d9388fb2d81

I get the following error:

TypeError: Failed to execute 'resolve' on 'import.meta': Failed to resolve module specifier uuid: Relative references must start with either "/", "./", or "../".

The uuid package is installed and I use Vite as the dev server.

I tried yield "./uuid" but it returns undefined.

Any idea what path is expected? Thank you 🙏

@aurelien-boubennec
Copy link
Author

Seems like the is the only way that works in my project: const { v4 } = yield "https://esm.sh/uuid"

Though I tried const { _ } = yield "https://esm.sh/lodash"; but _ is returned as undefined.

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

1 participant