rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

process.env.NODE_ENV unavailable in browser #88

Closed beverlycodes closed 8 years ago

beverlycodes commented 8 years ago

When attempting to use this package in a browser, I run into the error of process being undefined when it's called from the makeImmutable function. It seems like there should be a check for whether or not process exists before checking the env, since it won't exist in a browser. This would also mean having an alternate means of putting seamless-immutable into production mode when running in a browser.

bholloway commented 8 years ago

+1

rtfeldman commented 8 years ago

Hi @ryanfields and @bholloway,

You want to use either the development build or the production build - the source build, which has process in it, should not be used in the browser.

Sorry if that was unclear! :smile:

bholloway commented 8 years ago

Thanks @rtfeldman. I was using in JSBin so that should solve my issue.

However there might be a problem in the bower.json in that case, since it points to the src file. I would say it 99% of cases a Bower package goes straight to Web, rather than being used/built in a Node-like environment.

I am happy give you a PR for that fix and some clarification in the Docs but if you are opposed, or it is quicker for you to change yourself, then just let me know.

rtfeldman commented 8 years ago

A PR would be great!