tango.config.json
tango.config.json is the core configuration file of the Tango project. When your project uses Tango designer for online development, it will read this file to initialize the online development environment.
entry
Not required. entry is the entry file of the project, used for the initialization of the online designer. The default value is /src/index.js.
packages
The npm package dependency information used in the project is used to define the type of dependency and external dependency resources. This configuration item is a map, where the key is the corresponding npm package name, and the value is the configuration information for the dependency.
The dependency type type can be baseDependency, which is the basic dependency of the project used to obtain the project's basic material list information; it can also be bizDependency, which is the business component dependency used to obtain the business component list merged into the material panel business component menu; it can also be dependency, which is other dependencies of the project, used only to provide external information and version information, and does not have any relationship with the material panel.
When the external dependency resource resources and its corresponding global variable library are configured, when these dependencies are imported, the relevant resources will not be packaged into the bundle, but the extension dependencies will be obtained externally at runtime. This is equivalent to the previous sandbox.externalResources and sandbox.externals configuration items. In addition, the version number in resource can be replaced with {{version}}, which will be replaced with the version number at the time of platform construction. Specifically, designerResources can be defined for adapting to the platform's designer view.
{
"react": {
"version": "17.0.2",
"library": "React",
"type": "dependency",
"resources": ["https://unpkg.com/react@{{version}}/umd/react.development.js"]
},
"react-dom": {
"version": "17.0.2",
"library": "ReactDOM",
"type": "dependency",
"resources": ["https://unpkg.com/react-dom@{{version}}/umd/react-dom.development.js"]
},
"@music163/tango-boot": {
"version": "0.1.3",
"library": "TangoBoot",
"type": "baseDependency",
"resources": ["https://unpkg.com/@music163/tango-boot@{{version}}/dist/boot.js"],
"description": "tango app runtime framework"
},
"@music163/antd": {
"version": "0.1.2",
"library": "TangoAntd",
"type": "baseDependency",
"resources": [
"https://unpkg.com/@music163/antd/{{version}}/dist/index.js",
"https://unpkg.com/@music163/antd/{{version}}/dist/index.css"
],
"description": "component library for tango apps",
"designerResources": [
"https://unpkg.com/@music163/antd/{{version}}/dist/designer.js",
"https://unpkg.com/@music163/antd/{{version}}/dist/index.css"
]
},
"@music163/biz-comp": {
"type": "bizDependency",
"version": "0.0.2"
}
}
Since the dependencies are injected into the sandbox according to the order defined, it is necessary to ensure the order of dependencies in packages. Otherwise, it may cause the application to fail to load dependencies (for example, placing react after the component package will cause the component package to fail to load normally).
externalResources
In addition to the external dependency resources defined by the packages mentioned above, you can define a list of external dependency resources that are not npm packages and are introduced when the sandbox is started. These can be static files such as js or css. For example:
{
"externalResources": ["https://tango.netease.io/script.js"]
}
proxy
Not required. Proxy rules for the project.
{
"proxy": {
"/api/pms": {
"target": "http://cms.qa.igame.163.com",
"changeOrigin": true
}
}
}