{"action":"created","issue":{"url":"https://api.github.com/repos/tminglei/browserify-bower/issues/7","labels_url":"https://api.github.com/repos/tminglei/browserify-bower/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/tminglei/browserify-bower/issues/7/comments","events_url":"https://api.github.com/repos/tminglei/browserify-bower/issues/7/events","html_url":"https://github.com/tminglei/browserify-bower/issues/7","id":108504734,"number":7,"title":"Configuring mainfiles in package.json?","user":{"login":"ashlinallen","id":1440134,"avatar_url":"https://avatars.githubusercontent.com/u/1440134?v=3","gravatar_id":"","url":"https://api.github.com/users/ashlinallen","html_url":"https://github.com/ashlinallen","followers_url":"https://api.github.com/users/ashlinallen/followers","following_url":"https://api.github.com/users/ashlinallen/following{/other_user}","gists_url":"https://api.github.com/users/ashlinallen/gists{/gist_id}","starred_url":"https://api.github.com/users/ashlinallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashlinallen/subscriptions","organizations_url":"https://api.github.com/users/ashlinallen/orgs","repos_url":"https://api.github.com/users/ashlinallen/repos","events_url":"https://api.github.com/users/ashlinallen/events{/privacy}","received_events_url":"https://api.github.com/users/ashlinallen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-27T00:32:02Z","updated_at":"2015-09-28T10:36:33Z","closed_at":null,"body":"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:\r\n\r\nvar browserify   = require('browserify');\r\nvar browserifyBower = require('browserify-bower');\r\nvar bundler = browserify();\r\nbundler.plugin(browserifyBower, {\r\n  \"mainfiles\": {\r\n      \"myPlugin\": \"dist/myPlugin.min.js\"\r\n  }\r\n});\r\n\r\nI'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!"},"comment":{"url":"https://api.github.com/repos/tminglei/browserify-bower/issues/comments/143704014","html_url":"https://github.com/tminglei/browserify-bower/issues/7#issuecomment-143704014","issue_url":"https://api.github.com/repos/tminglei/browserify-bower/issues/7","id":143704014,"user":{"login":"tminglei","id":1828949,"avatar_url":"https://avatars.githubusercontent.com/u/1828949?v=3","gravatar_id":"","url":"https://api.github.com/users/tminglei","html_url":"https://github.com/tminglei","followers_url":"https://api.github.com/users/tminglei/followers","following_url":"https://api.github.com/users/tminglei/following{/other_user}","gists_url":"https://api.github.com/users/tminglei/gists{/gist_id}","starred_url":"https://api.github.com/users/tminglei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tminglei/subscriptions","organizations_url":"https://api.github.com/users/tminglei/orgs","repos_url":"https://api.github.com/users/tminglei/repos","events_url":"https://api.github.com/users/tminglei/events{/privacy}","received_events_url":"https://api.github.com/users/tminglei/received_events","type":"User","site_admin":false},"created_at":"2015-09-28T10:36:33Z","updated_at":"2015-09-28T10:36:33Z","body":"I didn't try it myself. But I just checked browserify source codes and found some codes like this:\r\n```javascript\r\n  // url: https://github.com/substack/node-browserify/blob/10.2.6/index.js#L96\r\n  [].concat(opts.plugin).filter(Boolean).forEach(function (p) {\r\n    self.plugin(p, { basedir: opts.basedir });\r\n  });\r\n...\r\n\r\n// url: https://github.com/substack/node-browserify/blob/10.2.6/index.js#L341\r\nBrowserify.prototype.plugin = function (p, opts) {\r\n  if (isarray(p)) {\r\n    opts = p[1];\r\n    p = p[0];\r\n  }\r\n...\r\n```\r\n\r\nSo you can try it in `package.json` like this:\r\n```javascript\r\n\"browserify\": {\r\n  \"plugin\": [\r\n    ...\r\n    [\"browserify-bower\", {\r\n      \"mainfiles\": {\r\n        \"myPlugin\": \"dist/myPlugin.min.js\"\r\n      }\r\n    }]\r\n  ]\r\n}\r\n```"}}