SyntaxHighlighter with webpack and react

I am trying to implement SyntaxHighlighter using react and webpack.

I install it via npm.

npm install --save syntaxhighlighter

It installs fine. Now the problem is how to import it correctly.

I tried like this:

import SyntaxHighlighter from 'syntaxhighlighter';

      

But it doesn't work, the Chrom console reports an error like:

TypeError: Unable to assign read-only property 'export' of object '#'

How can I use Highlighter syntax with webpack and react?

+3


source to share





All Articles