Skip to content

资源加载错误 #411

@wukangjun

Description

@wukangjun

Describe the bug (required) / 详细描述 bug(必填)

import { AssetLoader, buildComponents } from '@alilc/lowcode-utils';
AssetLoader.load能否支持串行加载,返回资源具有上下依赖关系

To Reproduce (required) / 如何复现 bug?(必填,非常重要)

image
此packages结构的在@alilc/lowcode-react-renderer的ReactRenderer中渲染,结果如下:
image
这说明pro相关的资源在antd之前加载完成了
Steps to reproduce the behavior: / 详细复现步骤:

  1. import ReactRenderer from '@alilc/lowcode-react-renderer';
  2. 使用了如上的packages的数据进行渲染,结果antd-pro资源先加载完成,导致报错

Expected behavior (required) / 预期行为(必填,非常重要)

A clear and concise description of what did you expect to happen. / 请清晰和精确的描述你预期的行为


Screenshots (optional) / bug 截图(可选)

错误截图:
image

正确效果图:
image


Environments (please complete the following information) (required): / 请提供如下信息(必填)

  • AliLowCodeEngine version: [e.g. 1.0.0] / 低代码引擎版本
  • AliLowCodeEngineExt version: [e.g. 1.0.0] / 低代码引擎扩展包版本
  • Browser [e.g. chrome, safari] / 浏览器版本
  • materials / plugins / tools / 其他物料 / 插件 / 工具链版本

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

schema结构如下:
{
"version": "1.0.0",
"componentsMap": [
{
"package": "@ant-design/pro-form",
"exportName": "ProFormText",
"main": "",
"destructuring": true,
"subName": "",
"componentName": "ProFormText"
},
{
"package": "@ant-design/pro-form",
"componentName": "ProForm"
},
{
"package": "@ant-design/pro-card",
"componentName": "ProCard"
},
{
"devMode": "lowcode",
"componentName": "Page"
}
],
"componentsTree": [
{
"componentName": "Page",
"id": "node_dockcviv8fo1",
"props": {
"ref": "outerView",
"style": {
"height": "100%"
}
},
"fileName": "功能A_B",
"dataSource": {
"list": []
},
"state": {
"text": {
"type": "JSExpression",
"value": ""outer""
},
"isShowDialog": {
"type": "JSExpression",
"value": "false"
}
},
"css": "body {\n font-size: 12px;\n}\n\n.button {\n width: 100px;\n color: #ff00ff\n}",
"lifeCycles": {
"componentDidMount": {
"type": "JSFunction",
"value": "function componentDidMount() {\n console.log('did mount');\n}"
},
"componentWillUnmount": {
"type": "JSFunction",
"value": "function componentWillUnmount() {\n console.log('will unmount');\n}"
}
},
"methods": {
"testFunc": {
"type": "JSFunction",
"value": "function testFunc() {\n console.log('test func');\n}"
},
"onClick": {
"type": "JSFunction",
"value": "function onClick() {\n this.setState({\n isShowDialog: true\n });\n}"
},
"closeDialog": {
"type": "JSFunction",
"value": "function closeDialog() {\n this.setState({\n isShowDialog: false\n });\n}"
}
},
"originCode": "class LowcodeComponent extends Component {\n state = {\n "text": "outer",\n "isShowDialog": false\n }\n componentDidMount() {\n console.log('did mount');\n }\n componentWillUnmount() {\n console.log('will unmount');\n }\n testFunc() {\n console.log('test func');\n }\n onClick() {\n this.setState({\n isShowDialog: true\n })\n }\n closeDialog() {\n this.setState({\n isShowDialog: false\n })\n }\n}",
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "ProCard",
"id": "node_ocl2ip4chn1",
"props": {
"title": "hello",
"tooltip": "这是提示",
"subTitle": "",
"loading": false,
"type": "inner",
"bordered": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "ProForm",
"id": "node_ocl2ipfeod2",
"props": {
"layout": "horizontal",
"grid": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": "",
"children": [
{
"componentName": "ProFormText",
"id": "node_ocl2ipfeod3",
"props": {
"name": "name",
"label": "签约客户名称",
"tooltip": "最长为24位",
"placeholder": "请输入名称",
"bordered": false,
"disabled": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "ProFormText",
"id": "node_ocl2ipfeod4",
"props": {
"name": "company",
"label": "我方公司名称",
"placeholder": "请输入名称",
"bordered": false,
"disabled": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
},
{
"componentName": "ProFormText",
"id": "node_ocl2ipfeod5",
"props": {
"name": [
"contract",
"name"
],
"label": "合同名称",
"placeholder": "请输入名称",
"bordered": false,
"disabled": false
},
"hidden": false,
"title": "",
"isLocked": false,
"condition": true,
"conditionGroup": ""
}
]
}
]
}
]
}
],
"i18n": {}
}

packages结构如下:
[
{
"package": "moment",
"version": "2.24.0",
"urls": [
"https://g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"
],
"library": "moment"
},
{
"package": "lodash",
"library": "_",
"urls": [
"https://g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js"
]
},
{
"package": "antd",
"version": "4.19.5",
"urls": [
"//g.alicdn.com/code/lib/antd/4.19.4/antd.min.js",
"//g.alicdn.com/code/lib/antd/4.19.4/antd.min.css"
],
"library": "antd"
},
{
"package": "@ant-design/icons",
"version": "4.7.0",
"urls": [
"//g.alicdn.com/code/npm/@ali/ant-design-icons-cdn/4.5.0/index.umd.min.js"
],
"library": "icons"
},
{
"package": "@ant-design/pro-card",
"version": "1.19.2",
"library": "ProCard",
"urls": [
"https://unpkg.com/@ant-design/pro-card@1.19.2/dist/card.js",
"https://unpkg.com/@ant-design/pro-card@1.19.2/dist/card.min.css"
]
},
{
"package": "@ant-design/pro-form",
"version": "1.62.1",
"library": "ProForm",
"urls": [
"https://unpkg.com/@ant-design/pro-form@1.62.1/dist/form.min.js",
"https://unpkg.com/@ant-design/pro-form@1.62.1/dist/form.min.css"
]
},
{
"package": "@ant-design/pro-table",
"version": "2.71.7",
"library": "ProTable",
"urls": [
"https://unpkg.com/@ant-design/pro-table@2.71.7/dist/table.min.js",
"https://unpkg.com/@ant-design/pro-table@2.71.7/dist/table.min.css"
]
},
{
"title": "fusion组件库",
"package": "@alifd/next",
"version": "1.24.18",
"urls": [
"https://g.alicdn.com/code/lib/alifd__next/1.24.18/next.min.css",
"https://g.alicdn.com/code/lib/alifd__next/1.24.18/next-with-locales.min.js"
],
"library": "Next"
},
{
"package": "lowcode-materials-antd-pro",
"version": "1.0.6",
"library": "LowcodeMaterialsAntdPro",
"urls": [
"https://unpkg.com/lowcode-materials-antd-pro@1.0.6/build/lowcode/view.js",
"https://unpkg.com/lowcode-materials-antd-pro@1.0.6/build/lowcode/view.css"
],
"editUrls": [
"https://unpkg.com/lowcode-materials-antd-pro@1.0.6/build/lowcode/view.js",
"https://unpkg.com/lowcode-materials-antd-pro@1.0.6/build/lowcode/view.css"
]
}
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions