I am working on several cocos2d js projects. The standard size of each project is about 420 mb where almost 400 mb is taken up by cocos2d-x and js-bindings folders under frameworks folder. It seems quite wasteful to me to have separate copies of these libraries for each project.
Is there a way to use single copies of these libraries for multiple cocos2d js projects? I tried changing engine directory in project.json file but it gives errors.
1 Like
Are you using Cocos Framework or Cocos2d-JS?
- Download cocos2djs (github or website) and save it (Example ; F:\Dev\cocos_src\cocos2d-js-v3.6.1)
- Execute setup.py
- Create a new cocos project anywhere (Example :F:\Dev\cocos\myproject)
- Remove F:\Dev\cocos\myproject\cocos2d-html5 and F:\Dev\cocos\myproject\js-bindings
- Open a cmd line and cd to F:\Dev\cocos\myproject\frameworks
- Create 2 symlinks to redefine cocos2d-html5 and js-bindings folders
Here is my commands in windows env (on mac, you can use ln -s command)
mklink /D cocos2d-html5 "F:\Dev\cocos_src\cocos2d-js-v3.6.1\frameworks\cocos2d-html5"
mklink /D js-bindings "F:\Dev\cocos_src\cocos2d-js-v3.6.1\frameworks\js-bindings"
Run your project
Done
Do it with all your projects, they will share the same framework.
2 Likes