引擎的工程化配置

目前引擎体系共包含 3 个 js 文件,即:

  1. <!-- engine-core 引擎的 core,负责引擎的基础模块 -->
  2. <script crossorigin="anonymous" src="//alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js"></script>
  3. <!-- engine-ext 引擎的扩展包,负责收拢内置 setters / plugins,方便迭代 -->
  4. <script crossorigin="anonymous" src="//alifd.alicdn.com/npm/@alilc/lowcode-engine-ext@1.0.1/dist/js/engine-ext.js"></script>

工程化配置我们进行了统一,具体如下:

  1. {
  2. "entry": {
  3. ...
  4. },
  5. "library": "...",
  6. "libraryTarget": "umd",
  7. "externals": {
  8. "react": "var window.React",
  9. "react-dom": "var window.ReactDOM",
  10. "prop-types": "var window.PropTypes",
  11. "rax": "var window.Rax",
  12. "@alilc/lowcode-engine": "var window.AliLowCodeEngine",
  13. "@alilc/lowcode-engine-ext": "var window.AliLowCodeEngineExt",
  14. "moment": "var moment",
  15. "lodash": "var _",
  16. "@alifd/next": "var Next"
  17. },
  18. "polyfill": false,
  19. "outputDir": "dist",
  20. "vendor": false,
  21. "ignoreHtmlTemplate": true,
  22. "sourceMap": true,
  23. "plugins": [
  24. "build-plugin-react-app",
  25. ["build-plugin-fusion", {
  26. }],
  27. ["build-plugin-moment-locales", {
  28. "locales": ["zh-cn"]
  29. }],
  30. "./build.plugin.js"
  31. ]
  32. }

总结一下,有 2 点:

  1. 都**不包含 polyfill,**需要应用级别单独引入 polyfill,推荐动态 polyfill
  2. 都不包含 lodash / moment / next

前置依赖资源:

  1. <link rel="stylesheet" href="//alifd.alicdn.com/npm/@alifd/next/1.20.25/next.min.css">
  2. <script src="//polyfill.alicdn.com/s/polyfill.min.js?features=default,es2017,es6,fetch,RegeneratorRuntime"></script>
  3. <script src="//alifd.alicdn.com/npm/@alifd/next/1.20.25/next.min.js"></script>
  4. <script src="//g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js"></script>
  5. <script src="//g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>

所有资源:

  1. <link rel="stylesheet" href="//alifd.alicdn.com/npm/@alifd/next/1.20.25/next.min.css">
  2. <link rel="stylesheet" href="//alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/css/engine-core.css"/>
  3. <link rel="stylesheet" href="//alifd.alicdn.com/npm/@alilc/lowcode-engine-ext@1.0.1/dist/css/engine-ext.css"/>
  4. <script src="//polyfill.alicdn.com/s/polyfill.min.js?features=default,es2017,es6,fetch,RegeneratorRuntime"></script>
  5. <script src="//alifd.alicdn.com/npm/@alifd/next/1.20.25/next.min.js"></script>
  6. <script src="//g.alicdn.com/platform/c/lodash/4.6.1/lodash.min.js"></script>
  7. <script src="//g.alicdn.com/mylib/moment/2.24.0/min/moment.min.js"></script>
  8. <!-- engine-core 引擎的 core,负责引擎的基础模块 -->
  9. <script crossorigin="anonymous" src="//alifd.alicdn.com/npm/@alilc/lowcode-engine@1.0.0/dist/js/engine-core.js"></script>
  10. <!-- engine-ext 引擎的扩展包,负责收拢内置 setters / plugins,方便迭代 -->
  11. <script crossorigin="anonymous" src="//alifd.alicdn.com/npm/@alilc/lowcode-engine-ext@1.0.1/dist/js/engine-ext.js"></script>