Dynamic filename issue
See original GitHub issueI am trying this library because I have not been able to dynamically import markdown files successfully using create-react-app. I am trying to avoid ejecting.
I saw a snippet on this thead: https://github.com/facebook/create-react-app/issues/3722
I am trying to load markdown files dynamically based on a prop lang
like so:
const markdown = raw(`./${lang}About.md`);
setView(markdown);
I get the following error:
raw.macro: There was a problem evaluating the value of the argument for the code: raw(
./${lang}About.md). If the value is dynamic, please make sure that its value is statically deterministic. Learn more:
What this error is saying is puzzling to me. If setting a path like this is not possible I understand, however if this is something that should be possible another way, would love to know how.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Dynamic filename output issues - KNIME Forum
I have this quick workflow where I use a grouploop to start grouping customer by customer, and a string manipulation to make the...
Read more >Solved: how to handle dynamic filenames in 'update a row'
Solved: Hi there, I'm trying to achieve following scenario : When a new "Microsoft Forms" response is submitted, I update an excel file....
Read more >Dynamic Filenames (or an array?) · Issue #4 - GitHub
The thing is, we have dynamic names in our filenames based on dates. Would something like this work? - name: Upload Asset to...
Read more >Dynamic file name issue - IBM Mainframe
FAQ & Basics: Hello, I am trying to pass a dynamically created file to my application program through JCL as 'DD DSN=ABC.D*.XYZ' *...
Read more >logging - log4net dynamic filename issue - Stack Overflow
I'm using log4net and trying to get a filename format that looks like this: AriaClient_2016_11_11_08_38_54-[7988 ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok good news: turns out it’s possible to do with some work. It’s basically similar with how webpack dynamic require works
The bad news is there’s a lot of cases to cover.
I’ve made a proof of concept in #37, feel free to send alternative solution or improve my PR.
Ok done, the dynamic value inside template literal is limited up to 2 variables (1 for directory name, and another one for filename). I think this should be more than enough and cover > 99% of use case when using dynamic import. I also added some notes in README regarding this limitation.
You can try it out it #37. I plan to merge it on Monday and release it as v0.4.0 if all goes well