{"action":"created","issue":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/12543","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/12543/labels{/name}","comments_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/12543/comments","events_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/12543/events","html_url":"https://github.com/cocos2d/cocos2d-x/issues/12543","id":90961428,"number":12543,"title":"Refactor Web engine's core to modules","user":{"login":"pandamicro","id":632460,"avatar_url":"https://avatars.githubusercontent.com/u/632460?v=3","gravatar_id":"","url":"https://api.github.com/users/pandamicro","html_url":"https://github.com/pandamicro","followers_url":"https://api.github.com/users/pandamicro/followers","following_url":"https://api.github.com/users/pandamicro/following{/other_user}","gists_url":"https://api.github.com/users/pandamicro/gists{/gist_id}","starred_url":"https://api.github.com/users/pandamicro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pandamicro/subscriptions","organizations_url":"https://api.github.com/users/pandamicro/orgs","repos_url":"https://api.github.com/users/pandamicro/repos","events_url":"https://api.github.com/users/pandamicro/events{/privacy}","received_events_url":"https://api.github.com/users/pandamicro/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/labels/highlight","name":"highlight","color":"eb6420"},{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/labels/platform:web","name":"platform:web","color":"fbca04"},{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/labels/type:feature","name":"type:feature","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"VisualSJ","id":7113508,"avatar_url":"https://avatars.githubusercontent.com/u/7113508?v=3","gravatar_id":"","url":"https://api.github.com/users/VisualSJ","html_url":"https://github.com/VisualSJ","followers_url":"https://api.github.com/users/VisualSJ/followers","following_url":"https://api.github.com/users/VisualSJ/following{/other_user}","gists_url":"https://api.github.com/users/VisualSJ/gists{/gist_id}","starred_url":"https://api.github.com/users/VisualSJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VisualSJ/subscriptions","organizations_url":"https://api.github.com/users/VisualSJ/orgs","repos_url":"https://api.github.com/users/VisualSJ/repos","events_url":"https://api.github.com/users/VisualSJ/events{/privacy}","received_events_url":"https://api.github.com/users/VisualSJ/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/milestones/26","html_url":"https://github.com/cocos2d/cocos2d-x/milestones/v3.9","labels_url":"https://api.github.com/repos/cocos2d/cocos2d-x/milestones/26/labels","id":1257468,"number":26,"title":"v3.9","description":"","creator":{"login":"minggo","id":488203,"avatar_url":"https://avatars.githubusercontent.com/u/488203?v=3","gravatar_id":"","url":"https://api.github.com/users/minggo","html_url":"https://github.com/minggo","followers_url":"https://api.github.com/users/minggo/followers","following_url":"https://api.github.com/users/minggo/following{/other_user}","gists_url":"https://api.github.com/users/minggo/gists{/gist_id}","starred_url":"https://api.github.com/users/minggo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minggo/subscriptions","organizations_url":"https://api.github.com/users/minggo/orgs","repos_url":"https://api.github.com/users/minggo/repos","events_url":"https://api.github.com/users/minggo/events{/privacy}","received_events_url":"https://api.github.com/users/minggo/received_events","type":"User","site_admin":false},"open_issues":14,"closed_issues":123,"state":"open","created_at":"2015-08-17T03:53:20Z","updated_at":"2015-10-06T13:38:14Z","due_on":"2015-09-17T16:00:00Z","closed_at":null},"comments":6,"created_at":"2015-06-25T13:15:07Z","updated_at":"2015-10-06T17:56:01Z","closed_at":null,"body":"The web engine is now managed by a dependency config file (moduleConfig.json) and a poor script insertion mechanism. AMD/CMD module management will be great for the web engine to manage module dependencies. \r\n\r\n## Essential benefits\r\n\r\n1. User and the engine itself can profit from module management feature.\r\n2. It can help user to build up their own web workflow and easily combine cocos with other frameworks.\r\n3. The granularity of modules can be greatly reduced, the result is that a web package can be very small.\r\n4. Avoid global variable pollution, reduce variables in some namespaces.\r\n\r\n## Proposed solution\r\n\r\n- [ ] Choose between require.js or CMD solution (like sea.js). AMD is more web friendly with asynchronous feature, but CMD have more compact API and usage.\r\n- [ ] Create a tool based on gulp or `r.js` directly to package all js files into one file and obfuscate the js file.\r\n- [ ] Refactor CCBoot.js to support two ways of dependency management (The old one and the new one).\r\n- [ ] Keep compatibility with old versions.\r\n- [ ] Refactor engine's core module with the new module management system.\r\n\r\n## IMPORTANT\r\n\r\nSHOULDN'T AFFECT API"},"comment":{"url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/comments/145946215","html_url":"https://github.com/cocos2d/cocos2d-x/issues/12543#issuecomment-145946215","issue_url":"https://api.github.com/repos/cocos2d/cocos2d-x/issues/12543","id":145946215,"user":{"login":"gamedolphin","id":7590634,"avatar_url":"https://avatars.githubusercontent.com/u/7590634?v=3","gravatar_id":"","url":"https://api.github.com/users/gamedolphin","html_url":"https://github.com/gamedolphin","followers_url":"https://api.github.com/users/gamedolphin/followers","following_url":"https://api.github.com/users/gamedolphin/following{/other_user}","gists_url":"https://api.github.com/users/gamedolphin/gists{/gist_id}","starred_url":"https://api.github.com/users/gamedolphin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gamedolphin/subscriptions","organizations_url":"https://api.github.com/users/gamedolphin/orgs","repos_url":"https://api.github.com/users/gamedolphin/repos","events_url":"https://api.github.com/users/gamedolphin/events{/privacy}","received_events_url":"https://api.github.com/users/gamedolphin/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T17:56:01Z","updated_at":"2015-10-06T17:56:01Z","body":"I have re-written the bootstrap cocos2d js app with webpack such that i'm able to require modules. Still relies on project.json to pick up the two source files though. \r\n\r\n[cocos2dx-webpack-example](https://github.com/gamedolphin/cocos2dx-webpack-example)"}}