kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.58k stars 150 forks source link

Uncaught LoadJS at success #53

Closed JFGHT closed 6 years ago

JFGHT commented 6 years ago

I'm using LoadJS with ReactJS.

This code is inside ComponentWillReceiveProps: https://jsfiddle.net/6n2khubb/

It works perfectly, even the setState executes correctly but the Uncaught LoadJS jumps in anyway. If I comment the line

this.setState({ reducers: reducers })

then, no exception is shown.

I'm using scriptjs with the same code and works like a charm.

amorey commented 6 years ago

That error is thrown when a bundle is defined multiple times so the most likely explanation is your loadjs code is being called twice: https://github.com/muicss/loadjs/blob/master/src/loadjs.js#L197-L204

JFGHT commented 6 years ago

True that. Thanks for the fast answer anyway.