{"action":"created","issue":{"url":"https://api.github.com/repos/arian/partition-bundle/issues/23","repository_url":"https://api.github.com/repos/arian/partition-bundle","labels_url":"https://api.github.com/repos/arian/partition-bundle/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/arian/partition-bundle/issues/23/comments","events_url":"https://api.github.com/repos/arian/partition-bundle/issues/23/events","html_url":"https://github.com/arian/partition-bundle/issues/23","id":140340011,"number":23,"title":"Could this be used with watchify?","user":{"login":"pke","id":164625,"avatar_url":"https://avatars.githubusercontent.com/u/164625?v=3","gravatar_id":"","url":"https://api.github.com/users/pke","html_url":"https://github.com/pke","followers_url":"https://api.github.com/users/pke/followers","following_url":"https://api.github.com/users/pke/following{/other_user}","gists_url":"https://api.github.com/users/pke/gists{/gist_id}","starred_url":"https://api.github.com/users/pke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pke/subscriptions","organizations_url":"https://api.github.com/users/pke/orgs","repos_url":"https://api.github.com/users/pke/repos","events_url":"https://api.github.com/users/pke/events{/privacy}","received_events_url":"https://api.github.com/users/pke/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-12T03:01:30Z","updated_at":"2016-03-19T09:28:47Z","closed_at":"2016-03-13T07:49:51Z","body":"I have my bundle splitting setup running with 'browserify' like this:\r\n'browserify -p [ partition-bundle --map partitions.json --output ./www --url www --main index ]' \r\n\r\nHowever, watchify demands and output file, which I dont have when using `partition-bundle`."},"comment":{"url":"https://api.github.com/repos/arian/partition-bundle/issues/comments/198673854","html_url":"https://github.com/arian/partition-bundle/issues/23#issuecomment-198673854","issue_url":"https://api.github.com/repos/arian/partition-bundle/issues/23","id":198673854,"user":{"login":"juice49","id":1454914,"avatar_url":"https://avatars.githubusercontent.com/u/1454914?v=3","gravatar_id":"","url":"https://api.github.com/users/juice49","html_url":"https://github.com/juice49","followers_url":"https://api.github.com/users/juice49/followers","following_url":"https://api.github.com/users/juice49/following{/other_user}","gists_url":"https://api.github.com/users/juice49/gists{/gist_id}","starred_url":"https://api.github.com/users/juice49/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juice49/subscriptions","organizations_url":"https://api.github.com/users/juice49/orgs","repos_url":"https://api.github.com/users/juice49/repos","events_url":"https://api.github.com/users/juice49/events{/privacy}","received_events_url":"https://api.github.com/users/juice49/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T09:28:46Z","updated_at":"2016-03-19T09:28:46Z","body":"@pke Sorry, I didn't receive an email for your comment.\r\n\r\nI'm afraid I don't have my mapping file anymore, last Saturday was the first time I experimented with code splitting in Browserify and I ended up switching to Substack's [factor-bundle](https://github.com/substack/factor-bundle) and Filament Group's [loadJS](https://github.com/filamentgroup/loadJS).\r\n\r\nI was a bit confused at first, and picked partition-bundle because it features a loader. I didn't really consider the fact that with factor-bundle, the split code simply has to be loaded via a script tag (or AJAXed and evald) before using it like normal.\r\n\r\nLooking at my factor-bundle code, I realise I actually deleted a bunch of the stuff I was playing with. I think this is roughly what I ended up with:\r\n\r\n```\r\n'use strict';\r\n\r\nimport load from 'fg-loadjs';\r\nimport test from './test'; // test module is split by factor-bundle\r\n\r\nconst isBrowser = typeof window !== 'undefined';\r\n\r\nif(isBrowser) {\r\n  // if we're in the browser, we first need to load the split file before using it\r\n  load('./test.js', test);\r\n} else {\r\n  // if the code has not been split, i.e. if it's running in node, just use it normally\r\n  test();\r\n}\r\n```\r\n\r\nApologies to the author for commenting this here. I'm sure partition-bundle has many use cases, but it just wasn't quite what I was looking for 😊.\r\n\r\n@pke I hope this is useful. The code might not run, but I hope explains what I mean!"}}