Closed ashlinallen closed 9 years ago
I didn't try it myself. But I checked browserify source codes and noticed some codes like this:
// at: https://github.com/substack/node-browserify/blob/10.2.6/index.js#L96
[].concat(opts.plugin).filter(Boolean).forEach(function (p) {
self.plugin(p, { basedir: opts.basedir });
});
...
// at: https://github.com/substack/node-browserify/blob/10.2.6/index.js#L341
Browserify.prototype.plugin = function (p, opts) {
if (isarray(p)) {
opts = p[1];
p = p[0];
}
...
So you can try it in package.json
like this:
"browserify": {
"plugin": [
...
["browserify-bower", {
"mainfiles": {
"myPlugin": "dist/myPlugin.min.js"
}
}]
]
}
Thanks! I didn't try it (I ended up moving away from the script I needed this for,) but this will be helpful in the future.
Hi, thanks for this plugin - it seems to be working very well and with much less pain than the other options. However, I have a minor problem. One of the bower components I'm using lacks a main field in its bower.json, so I'm having to override mainfiles in order to get the file I need. At the moment, my browserify gulp task works great when I specify browserify-bower's mainfiles field inside the task. For example:
I'd like to move the mainfiles field out from my browserify task and in to my package.json. Unfortunately, I can't seem to find the right configuration to make this work. Can this be done, and if so can you illustrate what the configuration would look like? Thanks again!