-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Dynamic Requires not working #443
Comments
Does something different happen if you do: const path = "./foo.md"
require(path) |
Well in my case the path is actually |
It's a bit hard to debug this without seeing your directory structure etc. I can't think of anything that Gatsby would be doing to cause trouble with dynamic requires. If you haven't read over this doc that might help: https://webpack.github.io/docs/context.html Something I've found useful in the past is finding and examining the context module that's created. |
Also something that's tripped me up a few times is that if Webpack has trouble loading your loader then it won't tell you that. So if you've customized the markdown loader, put a console.log in there to make sure it's getting run. |
OK, thanks for the tips. But I can work around it so I'll probably leave it for later. |
Ok great. I'll close this issue for now. Please reopen it if you discover it is a Gatsby caused problem. |
I'm trying to get dynamic requires to work but I'm running into a weird issue.
The following works:
But this gives me
Uncaught Error: Cannot find module '../../data/features/foo.md'.
:How can I get dynamic requires to work?
The text was updated successfully, but these errors were encountered: