@cloudbase/lowcode-builder 1.8.55 → 1.8.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ export declare function generateHTML({ buildContext, appId, envId, description,
12
12
  * 由于存量兜底逻辑存在
13
13
  * 默认值为 undefined 否则应为 false
14
14
  */
15
- enableLoading, }: {
15
+ enableLoading, publicPath, }: {
16
16
  buildContext: Omit<ICommonBuildContext, 'mainAppData'>;
17
17
  appId: string;
18
18
  envId: string;
@@ -25,6 +25,7 @@ enableLoading, }: {
25
25
  buildTypeList: BuildType[];
26
26
  cdnEndpoints?: ICDN_ENDPOINTS_COFIG;
27
27
  enableLoading?: boolean;
28
+ publicPath?: string;
28
29
  }): Promise<void>;
29
30
  export declare function handleAssets({ appBuildDir, buildTypeList, assets, }: {
30
31
  appBuildDir: string;
@@ -31,7 +31,7 @@ async function generateHTML({ buildContext, appId, envId, description = '', appB
31
31
  * 由于存量兜底逻辑存在
32
32
  * 默认值为 undefined 否则应为 false
33
33
  */
34
- enableLoading = undefined, }) {
34
+ enableLoading = undefined, publicPath = '/', }) {
35
35
  const { materialLibs, uin } = buildContext;
36
36
  const officialLib = materialLibs.find((item) => item.name === cals_1.OFFICIAL_LIB_KEY);
37
37
  const templatePath = path_1.default.join(config_1.appTemplateDir, 'html', 'index.html.ejs');
@@ -51,6 +51,21 @@ enableLoading = undefined, }) {
51
51
  }
52
52
  }
53
53
  }
54
+ let wedaPrivateConfigEndpoint = '';
55
+ /**
56
+ * 如果 public path 为 domain,
57
+ * 则文件要制定从静态托管桶加载
58
+ * 加载位置和webpack publicpath html规则一致
59
+ */
60
+ if (/^https?:/.test(publicPath)) {
61
+ try {
62
+ const url = new URL(publicPath);
63
+ if (url.origin) {
64
+ wedaPrivateConfigEndpoint = url.origin;
65
+ }
66
+ }
67
+ catch (e) { }
68
+ }
54
69
  await fs_extra_1.default.writeFile(dstFilePath, (0, lodash_1.template)(packageTpl)({
55
70
  appId,
56
71
  title: '',
@@ -62,6 +77,7 @@ enableLoading = undefined, }) {
62
77
  isBuildApp,
63
78
  isAdminPortal: (0, common_2.buildAsAdminPortalByBuildType)(buildTypeList),
64
79
  cdnEndpoints: (0, config_1.generateCdnEndpoints)(cdnEndpoints),
80
+ wedaPrivateConfigEndpoint,
65
81
  ext3: [envId, uin, index_1.version, officialLib === null || officialLib === void 0 ? void 0 : officialLib.version, '' /* mpappId */].join('|'),
66
82
  /**
67
83
  * @deprecated
@@ -36,6 +36,7 @@ async function runWebpackCore({ buildContext, cals, mainAppData, subAppDataList,
36
36
  isBuildApp: buildTypeList.includes(common_1.BuildType.APP),
37
37
  buildTypeList,
38
38
  cdnEndpoints,
39
+ publicPath,
39
40
  });
40
41
  if ((0, common_1.buildAsWebByBuildType)(buildTypeList)) {
41
42
  if (mode !== common_1.WebpackModeType.PRODUCTION) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "1.8.55",
3
+ "version": "1.8.56",
4
4
  "description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
5
5
  "author": "yhsunshining@gmail.com",
6
6
  "homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
@@ -453,7 +453,7 @@
453
453
  <% if(canUseVite){ %>
454
454
  <script type="module" src="/src/index.jsx"></script>
455
455
  <% } %> <% if(!isAdminPortal){ %>
456
- <script src="/weda-config/weda-private.js"></script>
456
+ <script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
457
457
  <script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.4.7-beta.0/cloudbase.full.js?v=1"></script>
458
458
  <% }%>
459
459
  <script>