choojs / bankai

:station: - friendly web compiler
Apache License 2.0
1.09k stars 102 forks source link

deprecate "browserify" configuration thru package.json #504

Open cancerberoSgx opened 6 years ago

cancerberoSgx commented 6 years ago

Your official recommendation to configure browserify is thru package.json "browserify" property. It works fine (and bankai made a nice job on my project BTW) but unfortunately, if I'm building a library (something that can be required by others) having a browserify configuration in the package.json will probably give an error when my users try to run browserify on their own projects.

See https://github.com/browserify/browserify/issues/1850 for details

An example, I just run bankai on my project which needed this in package.json:

 "browserify": {
     "transform": [
      ["babelify", {"presets": ["react"]}]
     ]
   },

Imagine that besides publishing my project in the web, I want to expose some APIs so others can require() my project. In that case, if they use browserify when they try generate the bundle on their projects, browserify will try to run that transformation and, that doesn't make any sense (since it's already compiled). For avoiding the problem I would have to include "babelify" and "babel-core" as "dependency" instead of "devDependency" in my project or manually remove the "browserify" property of my package.json on beforepublish.

So I would recommend you to at least document this, and in the future try to avoid configuring browserify like that - seems that kind of configuration is meant to run browserify when your project's dependencies compile, not when your project does. Also if I'm right you should provide other means of configuration.

Thanks for the tool, seems really good, keep it up !

goto-bus-stop commented 6 years ago

I think the one exception to what I said in browserify/browserify#1850 is application level config. You're definitely right though that it collides if you have a library that also includes in its repo an example application using bankai…