Bug when using import ReactBlockly from 'react-blockly' bug and 'index-dev.js' as entry point
See original GitHub issueIn the readme file wrote that:
Once you’ve done either of these, you should be able to import ReactBlockly from ‘react-blockly’; in your code and use ReactBlockly as a component.
But, basically, it’s not correct, I just try to use that like that but then it’s throwing an exception:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
The workaround for that is just to use the component as is: <ReactBlockly.BlocklyEditor .... />
The first interesting point is that in webpack.config the entry point is './src/dev-index.jsx' and not src/index.js - is it mistake or something ?
The second point is that index.js export object and not a component and that’s why we can’t use that as component
Maybe a clarify will be good here! @nbudin I could change it myself but first I need to understand exactly what happening here! Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)

Top Related StackOverflow Question
Thanks for checking! This is now published as version 6.0.1.
To be honest, the main reason the build is the way it is is because that’s the way we built it originally at PatientsLikeMe and I haven’t wanted to mess with it. I don’t claim that it is the best possible choice overall, just that with the minimal amount of time I have to give to this package I haven’t wanted to risk breaking it by changing the build process.
One possible advantage of separate files is that if you only wanted to import one of the components, you could do it directly by path (e.g.
import BlocklyToolbox from 'react-blockly/dist/BlocklyToolbox'or something like that), and then your bundle would be smaller than importing the whole thing. For this package, though, I can’t see a big advantage to that, since I assume almost everyone would want the whole thing.In any case, I basically just haven’t wanted to risk breaking the build for everyone.
This is now shipped as version 6.0.0! Thanks for the PR.