-
Notifications
You must be signed in to change notification settings - Fork 27
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
Load dynamic node modules #27
Comments
Are you seeing an error? |
Yes, I'm getting
even though the module is definitely installed. Do I need to provide an absolute path or something? |
have you tried to remove node_modules and reinstall it? |
Yes, I tried that. No change. Since it's a named export, not a default one, I also tried const { Github } = await import(obj.nodeModule)
const Github = await import(obj.nodeModule).Github
const Github = await import(obj.nodeModule)[`Github`] but none of those variations had any effect. |
What bundler are you using? I can't really tell what's the issue, but it seems to me that the bundler isn't resolving the asset. If the import() returns a promise, async-reactor will work. |
It's a Gatsby project so the bundler is webpack. |
Is it possible to load node modules asynchronously using
async-reactor
. The following snippet does not work but I hope explains the use case:obj.nodeModule
is a dynamic string and the import path of a node module, in my casestyled-icons
, e.g.obj.nodeModule = styled-icons/boxicons-logos/Github
.The text was updated successfully, but these errors were encountered: