Developers Manual > Cocos2d-JS > Features Of Cocos2d-JS > Modularization in Cocos2d-JS

Modularization in Cocos2d-JS

version: cocos2d-js v3.0 and higner
update: Updated about 2 years ago

Summary

The old jsloader.js is replaced with moduleConfig.json to make the config pure and support tools like cocos-console better.

Description

module

All the modules of Cocos2d-html5 are configured here. If you need some modules in your project, just configure the names in modules of project.json.

The config of each module is an array which includes module name or JavaScript path, like:

1
2
3
4
5
6
"menus" : [
    "core", "actions",

    "cocos2d/menus/CCMenuItem.js",
    "cocos2d/menus/CCMenu.js"
]

This means menus requires core and actions, and has cocos2d/menus/CCMenuItem.js and cocos2d/menus/CCMenu.js.

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.