ecsyjs / ecsy

Entity Component System for javascript
https://ecsyjs.github.io/ecsy/
MIT License
1.11k stars 115 forks source link

Replace DEBUG with process.env.NODE_ENV #217

Closed sheepsteak closed 4 years ago

sheepsteak commented 4 years ago

I saw a few @todo comments in the code about this so thought I would have a go at implementing something.

I thought this change made sense as CommonJS users can have process.env.NODE_ENV controlled by Webpack/Parcel/Rollup to have debug code automatically removed in a production build similar to React. UMD/ES Module users get a similar experience by switching between the unminified and minified builds.

Going forward it means ECSY can start to add more debug code to functions for better DX but can keep bundle size low.

fernandojsg commented 4 years ago

@sheepsteak really nice work! this is super useful!! <3