Open andineck opened 9 years ago
Neat, thanks for posting this as it may definitely help others. Might be rad to add this to the README.
I also just came across this, and totally It's great to have the ability to set this value in this way. I do wonder whether it might be worth a refactor to support:
"browserify": {
"transform": [
["brfs"],
["envify", {"purge": true}]
]
}
At the very least adding something to the README to highlight this would be ideal. :)
Probably worth a ref: #29
I’ve noticed that I can’t override the environment variable if I specify it in the transform. With this in the browserify.transform
key:
"browserify": {
"transform": [
["envify", {"_": "purge", "NODE_ENV": "from transform"}]
]
}
and then running:
% NODE_ENV='from env' browserify .
will produce the output with process.env.NODE_ENV
being replaced with "from transform"
. However, if you do not have a browserify.transform
key specified and you run:
% NODE_ENV='from env' browserify . -t [ envify purge --NODE_DEV 'from args' ]
you will see process.env.NODE_ENV
being replaced with "from env"
.
I’ve created a test repository if anyone wants to try it out. What‘s the right behaviour here?
Anyone have an idea if package.json config can be used for props other than transform
, like detectGlobals, or similar:
"browserify": {
"transform": [
["babelify"]
],
detectGlobals: false
},
It took me a while to get the envify purge option right inside the package.json.
I'm just posting it here for reference.
note: brfs is not needed, it's just showing how to add several transforms.