How to add support for web platform?

How to add support for web platform?


I’m using following command to create new project.

cocos new MyGame -p com.MyCompany.MyGame -l cpp -d ~/MyCompany

but what i get in platform support Android, iOS, Mac, linux.

20%20PM 20%20PM

So my question is : How do i get Web platform as well for project? and yes i want to use cpp.(not lua or js)


cpp doesn’t work for the web. You need javascript.


So is there any work around to export cpp project for web or i must have to use js?


Well, c++ uses OpenGL and OpenGL isn’t available for the web. WebGL is and that requires javascript.


You can try to look at
But I’m afraid you would have to do some heavy lifting yourself and the result may still be unpleasant (in terms of loading speed/distribution size). You can search for ‘cocos2dx + emscripten’ to find something useful but at the end that is no supported officialy so it’s up to you to do a lot of work.

On the other hand, if the project is not as complex, then you could look for another (less popular/less developed) C++ engine that already have emscripten/asm.js/wasm support.