react-markdown: Remark-parse invalid value error

I tried using this library and even the simplest example gives me the following error. I’ve tried a few versions back and forward but it always seems to pop-up.

import ReactMarkdown from 'react-markdown';
...
...
render() {
   const input = '# Test';
   return (
      <ReactMarkdown source={input} />
      <ReactMarkdown source="# Test" />
      <ReactMarkdown>
         # Test
      </ReactMarkdown>
   );
}

None of this component attempts seem to work. I’m using webpack 4 and React 16.

Console error:

set-options.js:37 Uncaught Error: Invalid value `/8df95e1fe7780fec0873a78ac40d96ec.json` for setting `options.blocks`
    at Of.setOptions (set-options.js:37)
    at Of.Parser (parser.js:16)
    at new Of (index.js:43)
    at Function.parse (index.js:277)
    at ReactMarkdown (react-markdown.js:32)
    at ProxyFacade (react-hot-loader.development.js:675)
    at mountIndeterminateComponent (react-dom.development.js:13381)
    at beginWork (react-dom.development.js:13821)
    at performUnitOfWork (react-dom.development.js:15864)
    at workLoop (react-dom.development.js:15903)

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16

Most upvoted comments

Thanks for the reproduced issue!

I think that saying all JSON-files should be treated as text will break a lot of things… If this is something you use in your app, perhaps make sure that node_modules are not included in this rule (in the same way as the babel loader is configured)?

If you have specific dependency/dependencies inside of node_modules containing JSON files that you would like to be treated as text, perhaps use a include option for the loader for those specific paths?

I don’t consider this to be a react-markdown issue at least - if you still feel like this is something that libraries should support, perhaps file an issue with remark-parse?

@adamblvck

You may need an appropriate loader to handle this file type.

Are you loading the markdown content from a file by any chance? If you are, you’ll need something like raw-loader for it to be imported/required properly as a string. Otherwise nevermind 😉