Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@alifd/build-plugin-lowcode插件 如何传customPlugins问题 #2701

Closed
mrliyaya opened this issue Nov 27, 2023 · 6 comments
Closed

@alifd/build-plugin-lowcode插件 如何传customPlugins问题 #2701

mrliyaya opened this issue Nov 27, 2023 · 6 comments
Assignees
Labels
discussion Discussion / 方案探讨

Comments

@mrliyaya
Copy link

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

请问 customPlugins 如何正确传递,尝试了以下两种方法都未生效,
第一种:传递函数类型 {customPlugins: [()=> {}]}
第二种: 传递字符串类型 {customPlugins: ['./testPlugin.js']}
A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述
内部处理 customPlugins 用了 customPlugins: JSON.stringify(customPlugins), 传函数的话 会被过滤掉
image


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

Steps to reproduce the behavior: / 详细复现步骤:


English version example:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

中文版示例:

  1. 打开 demo
  2. 点击标题;
  3. 在右侧修改标题内容为「修改后的标题」;
  4. 渲染画布标题组件没有更新显示为「修改后的标题」;

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

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


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

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


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) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

@liujuping
Copy link
Collaborator

试一下:

{
  "plugins": [
    [
      "@alifd/build-plugin-lowcode",
      {
        "customPlugins": [
          ["./path/to/your-custom-plugin", { /* 你的插件选项 */ }]
        ]
      }
    ]
  ]
}

@mrliyaya
Copy link
Author

mrliyaya commented Nov 27, 2023

试一下:

{
  "plugins": [
    [
      "@alifd/build-plugin-lowcode",
      {
        "customPlugins": [
          ["./path/to/your-custom-plugin", { /* 你的插件选项 */ }]
        ]
      }
    ]
  ]
}

尝试了下绝对路径这种写法,pluginContextMap 多了一项,plugins 没添加上

    ['/xxxxx/yyyy/lowcode-plugins/test.js', { pluginName: 'TestPlugin' }]
]```

![image](https://github.com/alibaba/lowcode-engine/assets/148785673/6fe42be5-8b0c-4333-b582-f7713034d1d8)

@liujuping
Copy link
Collaborator

先加上一些日志,看一下 plugin 是不是没有执行哈。

@mrliyaya
Copy link
Author

我debug了下,发现以下问题

  1. build-plugin-lowcode 这个项目的 的public的模版通过<script src="<%= enginePresetJsUrl %>"></script>以cdn的方式引入,用户不传enginePresetJsUrl的时候,使用默认值,默认值是https://alifd.alicdn.com/npm/@alilc/[email protected]/dist/lowcode-preset-plugin.js,@alilc/lowcode-preset-plugin 这个包没有实现 customPlugins的功能
  2. @alifd/lowcode-preset-plugin 这个包实现了 customPlugins的功能,但是直接传入 https://alifd.alicdn.com/npm/@alifd/[email protected]/dist/editor-preset-plugin.js 会导致页面报如下错误
    image
  3. 使用 window.AliLowCodeEngine.plugins.register(TestPlugin),因为执行时机问题,引擎已经初始化完成了,插件没初始化

@eternalsky
Copy link
Collaborator

eternalsky commented Nov 29, 2023

customPlugins 我看了一下代码里还没有实现,只是留了一个口子,我们的插件文档上也没有这个属性对应的 API,你是从哪里看到这个配置上的呢~ https://www.npmjs.com/package/@alifd/build-plugin-lowcode

@eternalsky
Copy link
Collaborator

如果希望联调插件和组件的话,可以使用我们提供的注入调试的方式来进行调试会更加简单和便捷。

@eternalsky eternalsky added the discussion Discussion / 方案探讨 label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion / 方案探讨
Projects
None yet
Development

No branches or pull requests

3 participants