-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
browserify field flags to switch behavior based on dev/prod/... #1706
Comments
To ignore the transform/browserify fields of other package.json files, pass This was very recently added and apparently not documented. Check the last commit that changed this repository's index.js. That commit also has a test you can look at. |
Sorry, scratch the above - didn't get your answer the first time - please see below |
Oh great. I re-read what you were saying, so basically a {
"browserify": {
"transform": [
["babelify", {
"presets": ["es2015"]
}]
],
"production": [
["babelify", {
"plugins": [ "yo-yoify" ],
"presets": ["es2015"]
}],
["uglifyify"]
]
},
"scripts": {
"start": "browserify index.js > bundle.js",
"build": "browserify --transformKey=browserify --transformKey=production index.js > bundle.js"
}
} I'll try that. Update2: I also think it's kind of crazy to add {
"browserify": {
"transform": [
["babelify", {
"presets": ["es2015"]
}]
],
"production": [
["babelify", {
"plugins": [ "yo-yoify" ],
"presets": ["es2015"]
}],
["uglifyify"]
]
},
"scripts": {
"start": "browserify index.js > bundle.js",
"dev": "browserify --transformKey=transform index.js > bundle.js # same as `npm start`",
"build": "browserify --transformKey=production index.js > bundle.js"
}
} If this is cool, I'd like to make a pull request :-) |
Here you go #1709 - changed the proposal from above slightly to use:
Maybe it would be even better to name it |
ok got merged. perfect :-) |
Browserify has the awesome feature, that every dependency can specify it's own transforms in a "browserify" field in it's
package.json
👍My issue:
Idea:
Is it or would it be possible to switch the behavior of a module's "browserify pipeline" as defined in it's "browserify field" based on environment variables or alternatively based on spec?
I would be willing to try to come up with an implementation and a pull request - but i first want to make sure if this would be acceptable and if so - what would be the best way :-)
The text was updated successfully, but these errors were encountered: