reactjs - require is not defined in react while working with Chatbot -
i'm new in react js, i'm setting chatbot in react.
i'm facing referenceerror: require not defined
error
how solve problem.
var chatbot = require('react-simple-chatbot'); const steps = [ { id: '0', message: 'welcome react chatbot!', trigger: '1', }, { id: '1', message: 'bye!', end: true, }, ]; reactdom.render( <div> <chatbot steps={steps} /> </div>, document.getelementbyid('root') );
basically need transform source code browser, replacing require calls actual module code. take @ these utilities:
- http://browserify.org/ - transformation need
- https://webpack.github.io/ - more complicated web packaging framework, lots of other useful features.
i recommend second.
Comments
Post a Comment