Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using envify purge option in package.json browserify field #26

Open
andineck opened this issue Apr 21, 2015 · 4 comments
Open

using envify purge option in package.json browserify field #26

andineck opened this issue Apr 21, 2015 · 4 comments

Comments

@andineck
Copy link

It took me a while to get the envify purge option right inside the package.json.

I'm just posting it here for reference.

  "browserify": {
    "transform": [
      ["brfs"],
      ["envify", {"_": "purge"}]
    ]
  },

note: brfs is not needed, it's just showing how to add several transforms.

@yoshuawuyts
Copy link
Collaborator

Neat, thanks for posting this as it may definitely help others. Might be rad to add this to the README.

@joshgillies
Copy link

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

@casr
Copy link

casr commented Jul 13, 2016

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?

@thinkloop
Copy link

thinkloop commented Dec 10, 2016

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
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants