@lark-apaas/fullstack-rspack-preset 1.0.50-alpha.3 → 1.0.50-alpha.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.
package/lib/preset.js
CHANGED
|
@@ -377,12 +377,6 @@ function createRecommendRspackConfig(options) {
|
|
|
377
377
|
changeOrigin: true,
|
|
378
378
|
onError: sendBackendUnavailable502,
|
|
379
379
|
},
|
|
380
|
-
{
|
|
381
|
-
context: [`${clientBasePath}/openapi`],
|
|
382
|
-
target: `http://localhost:${serverPort}`,
|
|
383
|
-
changeOrigin: true,
|
|
384
|
-
onError: sendBackendUnavailable502,
|
|
385
|
-
},
|
|
386
380
|
{
|
|
387
381
|
context: [`${clientBasePath}/__innerapi__`],
|
|
388
382
|
target: `http://localhost:${serverPort}`,
|
|
@@ -90,10 +90,19 @@ class SlardarPerformanceMonitorPlugin {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
exports.default = SlardarPerformanceMonitorPlugin;
|
|
93
|
+
function getEarlyResourceErrorTag(globalName) {
|
|
94
|
+
return {
|
|
95
|
+
tagName: 'script',
|
|
96
|
+
voidTag: false,
|
|
97
|
+
innerHTML: `(function(g){if(!window[g]){var q=[];window[g]=function(){q.push([].slice.call(arguments));};window[g].q=q;}window.addEventListener('error',function(e){if(e.error!=null||!(e.target instanceof Element))return;var t=e.target,url=t.src||t.href||'';if(!url)return;window[g]('captureException',new Error('Resource load failed: '+url),{team:'miaoda-sdk',source:'resource-error',resourceType:t.tagName.toLowerCase(),resourceUrl:url});},true);})('${globalName}');`,
|
|
98
|
+
attributes: {},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
93
101
|
function getSlardarScriptContent(option = {}) {
|
|
94
102
|
const bid = option.bid || 'apaas_miaoda';
|
|
95
103
|
const globalName = option.globalName || 'KSlardarWeb';
|
|
96
104
|
return [
|
|
105
|
+
getEarlyResourceErrorTag(globalName),
|
|
97
106
|
{
|
|
98
107
|
tagName: 'script',
|
|
99
108
|
voidTag: false,
|