question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic filename issue

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pveyescommented, Jul 17, 2020

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.

1reaction
pveyescommented, Jul 18, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found