hughsk / envify

:wrench: Selectively replace Node-style environment variables with plain strings.
901 stars 57 forks source link

(Bug or not?) Should it replace variables in expressions that are not comparisons? #34

Closed alexeyraspopov closed 9 years ago

alexeyraspopov commented 9 years ago

After using Envify as a Browserify's transform I still can see something like var env = process.env.NODE_ENV || 'development'; in my code. Is it correct behavior or am I doing something wrong?

zertosh commented 9 years ago

sounds like you're doing something wrong - that should be transformed. do you something i can test/look at?

alexeyraspopov commented 9 years ago

@zertosh there is small gist that can be used for reproducing https://gist.github.com/alexeyraspopov/36efb2931bd1bb969510

zertosh commented 9 years ago

Ah, because envify isn't being run as a global transform. The way you're using it, it's only applied to your files, not your node_modules. Try browserify index.js -t babelify -g envify.

alexeyraspopov commented 9 years ago

Cool, it works! Thank you!