justmoon / node-extend

Simple function to extend objects
MIT License
341 stars 68 forks source link

ReferenceError: isPlainObject is not defined #31

Closed jonaswindey closed 8 years ago

jonaswindey commented 9 years ago

I have a very strange bug on Chrome which throws this error when my development tools aren't open.

I'm using webpack + react + counterpart (which requires this module).

The weird thing is that when I open my development tools, the method isPlainObject is clearly defined, but not when it's closed.

On Safari/FF everything works. It seems like a scope issue when requiring this module via webpack that isPlainObject should be called like _this.isPlainObject and exposing this as _this in the top of the index.js.

Any suggestions?

ljharb commented 9 years ago

I'm not really sure as I use browserify instead of webpack. Could you provide a gist of the relevant post-webpack code? "this" should be undefined (or the global object) in any IIFE, which all commonJS modules are wrapped in, so I wouldn't expect to, nor accept, using "this" anywhere.

delacruz-dev commented 9 years ago

@jonaswindey hey, I'm having exactly the same issue here. Did you find any workaround or solution?

jonaswindey commented 9 years ago

@danderu no, I finally used react-intl which doesn't rely on counterpart. Let me know if you find a workaround though.

damienleroux commented 8 years ago

I had the same problem (using React, mobersvable-react & extend). I finally found out that it was my version of extend that was not up to date. I used 2.0 instead of 3.0. Hope it can help others

ljharb commented 8 years ago

I'm going to close this unless a reproducible test case can be provided.