lowcode-engine icon indicating copy to clipboard operation
lowcode-engine copied to clipboard

自定义solution,通过设计器插件使用时报错

Open GentleSen opened this issue 3 years ago • 1 comments

详细描述 bug

请提供清晰且精确的 bug 描述

自定义solution,通过自定义设计器插件的方式使用时出现报错


如何复现 bug?

详细复现步骤: 1、使用 npx @alilc/lowcode-code-generator init-solution testSolution 初始化项目。 2、发包之后,在 designer 中使用。 关键代码如下:

import testSolution from 'testSolution';
// 开启出码功能
await plugins.register(testSolution, {});

3、执行 npm run start 启动 designer,出现报错,报错内容如下:

 WARNING  Compiled with 2 warnings                                                                                                                11:32:07
 warning  in ./node_modules/_@[email protected]@@alilc/lowcode-code-generator/es/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 warning  in ./node_modules/_@[email protected]@@alilc/lowcode-code-generator/es/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 ERROR  Failed to compile with 2 errors                                                                                                           11:32:07
This dependency was not found:
* fs in ./node_modules/_@[email protected]@@alilc/lowcode-code-generator/es/index.js, ./node_modules/[email protected]@snapdragon/lib/source-maps.js
To install it, you can run: npm install --save fs

预期行为

请清晰和精确的描述你预期的行为

可以正常使用 自定义 solution.


bug 截图

image


请提供如下信息

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

GentleSen avatar Dec 28 '22 03:12 GentleSen

建议先尝试把 testSolution 在 node 端可以正常运行,再去弄 browser 里的吧,browser 里可能会有一些约束~

LeoYuan avatar Jan 04 '23 02:01 LeoYuan

请问这个问题怎么解决的呢?

Wangjing991 avatar Apr 24 '23 07:04 Wangjing991

  1. 先按照 node 端可以跑通的标准把自定义 solution 搞好;
  2. 再看看 browser 上如何打包这个 solution,参考 https://github.com/alibaba/lowcode-code-generator-demo 的代码;

LeoYuan avatar Apr 24 '23 07:04 LeoYuan

  1. 先按照 node 端可以跑通的标准把自定义 solution 搞好;
  2. 再看看 browser 上如何打包这个 solution,参考 https://github.com/alibaba/lowcode-code-generator-demo 的代码;

image node端出码没问题,现在就是生成的包 接入 lowcode-code-generator-demo这个项目的时候报错

Wangjing991 avatar Apr 24 '23 07:04 Wangjing991

这个你自己研究研究。。。standalone 版本似乎是没有 fs polyfill

LeoYuan avatar Apr 24 '23 07:04 LeoYuan

这个你自己研究研究。。。standalone 版本似乎是没有 fs polyfill

image g构建的时候忽略了这个,solution 脚手架生成的是esm包,是不是可以考虑生成包的地方优化

Wangjing991 avatar Apr 24 '23 07:04 Wangjing991