Closed
Description
Hey,
So I'm building a simple doc site at the moment and using CRA for this. I'm using react-markdown which depends on json-loader
to do it's job. json-loader
is enabled by default in webpack 2+ so CRA should work without a problem, but instead of printing the contents as it should I get the following printed out:
/static/media/path.e4d613b6.md
thats the path to the markdown file.
This is the code importing the markdown:
const loadMd = m => {
var Markdown = asyncMarkdown(() =>
import(`./../markdown/${m}.md`).then(
module => console.log(module),
err => console.log(err)
)
);
return <loadMd />;
};
function Content(props) {
return (
<div>
{loadMd("path")}
</div>
);
}
I've used this same code and it works outside of CRA so I'm not exactly sure why it is loading the path now instead of the content. Any clues?
Activity
viankakrisna commentedon Aug 29, 2017
Hi! You can use
fetch
instead of dynamicimport
to read the contents of the file. Read more here #2961 (comment)gaearon commentedon Jan 9, 2018
New thoughts on how we could handle this: #3722.