@lark-apaas/fullstack-rspack-preset 1.0.8-alpha.log.3 → 1.0.8-alpha.log.5

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.
@@ -16,11 +16,11 @@ function ErrorContainer(document, root, errorTitle) {
16
16
  // 创建图片元素
17
17
  const img = document.createElement('img');
18
18
  img.src =
19
- 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/render_error.svg';
19
+ 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg';
20
20
  img.alt = 'Error';
21
21
  // 图片占位
22
- img.width = 200;
23
- img.height = 200;
22
+ img.width = 100;
23
+ img.height = 100;
24
24
  img.className = 'overlay-error-image';
25
25
  content.appendChild(img);
26
26
  // 创建标题元素
@@ -67,7 +67,7 @@ function RootStyle(document, root) {
67
67
 
68
68
  .overlay-error-image {
69
69
  margin-bottom: 12px; /* mb-3 */
70
- width: 200px; /* w-[200px] */
70
+ width: 100px; /* w-[100px] */
71
71
  height: auto;
72
72
  }
73
73
 
@@ -175,6 +175,15 @@ function logError(messages, noStacktrace = false) {
175
175
  return;
176
176
  }
177
177
  // 首次执行编译报错会走此处逻辑;
178
+ const parts = [];
179
+ for (const m of messages) {
180
+ if (m instanceof Error) {
181
+ parts.push(m.message, m);
182
+ }
183
+ else {
184
+ parts.push(m);
185
+ }
186
+ }
178
187
  const logJSON = {
179
188
  id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
180
189
  const r = Math.random() * 16 | 0;
@@ -183,13 +192,13 @@ function logError(messages, noStacktrace = false) {
183
192
  }),
184
193
  type: 'typedLogV2',
185
194
  level: 'error',
186
- args: messages.map(item => item instanceof Error ? `${item.message}\n${item.stack}\n` : item),
195
+ args: parts,
187
196
  meta: {
188
197
  noStacktrace,
189
198
  stacktrace: noStacktrace ? [] : undefined,
190
199
  }
191
200
  };
192
- sendPostMessage({ type: 'SELECTED_LOG', payload: logJSON });
201
+ sendPostMessage({ type: 'SELECTED_LOG', payload: JSON.stringify(logJSON) });
193
202
  }
194
203
  catch (e) {
195
204
  console.log('上报错误信息失败', e);
@@ -227,7 +236,7 @@ function render() {
227
236
  // 发送运行错误
228
237
  logError(['Uncaught Render Error', ...currentRuntimeErrors]);
229
238
  // 叠加全部报错,将报错信息发送到妙搭
230
- ErrorContainer(rootDocument, root, '哎呀,出错了');
239
+ ErrorContainer(rootDocument, root, '页面出错了,请联系管理员');
231
240
  }
232
241
  });
233
242
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.8-alpha.log.3",
3
+ "version": "1.0.8-alpha.log.5",
4
4
  "files": [
5
5
  "lib",
6
6
  "preset.config.js"