remarkjs / remark-react

Legacy plugin to transform to React — please use `remark-rehype` and `rehype-react` instead
https://unifiedjs.com
MIT License
524 stars 37 forks source link

TypeError: Cannot set property 'Compiler' of undefined #34

Closed kand617 closed 7 years ago

kand617 commented 7 years ago

I am getting a really strange error. Using webpack if that makes a difference.... Would really appreciate the help...


import React, { Component } from 'react';
import RaisedButton from 'material-ui/RaisedButton';
import remark from 'remark';
import reactRenderer from 'remark-react';
class KComponent extends Component {
  render() {
    console.log("rendering K" );
    var item = remark().use(reactRenderer).processSync('# hello').contents

    return (<div>
        hello
    </div>)
  }
}

export default KComponent;

chorme output

Uncaught TypeError: Cannot set property 'Compiler' of undefined
    at Function.plugin (eval at ./node_modules/remark-react/index.js (0.chunk.js:2911), <anonymous>:95:24)
    at freeze (eval at ./node_modules/unified/index.js (0.chunk.js:3908), <anonymous>:122:28)
    at Function.processSync (eval at ./node_modules/unified/index.js (0.chunk.js:3908), <anonymous>:392:5)
    at KComponent.render (eval at ./app/containers/FeaturePage/TestComponent.js (0.chunk.js:47), <anonymous>:72:125)
wooorm commented 7 years ago

@kand617 This issue is probably because you haven’t updated remark yet. Could you check your versions?

wooorm commented 7 years ago

Oh sorry, I see that remark-react hasn’t been published yet. That should happen soon, but for now you could depend on the github repo (mapbox/remark-react) instead of the npm package (remark-react) to mitigate this.

kand617 commented 7 years ago

Hello,

I am impressed. Thank you for the really quick reply.

kand617 commented 7 years ago

The issue has been resolved on your github

sutiwo commented 7 years ago

thank u for creating this issue. i just faced the same problem.

tmcw commented 7 years ago

3.1.1 was released, and includes a fix for this issue.