@blocklet/pages-kit 0.4.131 → 0.4.133
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/cjs/builtin/markdown/markdown-renderer.js +3 -2
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/inject-global-components.js +15 -11
- package/lib/esm/builtin/markdown/markdown-renderer.js +3 -2
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/inject-global-components.js +15 -11
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ export function injectGlobalComponents() {
|
|
|
39
39
|
if (win[BuiltinModulesGlobalVariableName]) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
const enableShim = !!
|
|
42
|
+
const enableShim = !!win?.esmsInitOptions?.shimMode && win.importShim;
|
|
43
43
|
if (!enableShim && win.importShim?.addImportMap) {
|
|
44
44
|
win.importShim.addImportMap = () => {
|
|
45
45
|
// avoid addImportMap error
|
|
@@ -223,17 +223,21 @@ export default ${hasDefaultExport ? 'moduleSource.default' : 'moduleSource'};
|
|
|
223
223
|
}
|
|
224
224
|
// 添加 resolve 配置
|
|
225
225
|
const importMap = { imports };
|
|
226
|
-
if (enableShim) {
|
|
227
|
-
window.importShim.addImportMap(importMap);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
// fallback to create script tag
|
|
231
|
-
const script = document.createElement('script');
|
|
232
|
-
script.type = 'importmap';
|
|
233
|
-
script.textContent = JSON.stringify(importMap, null, 2);
|
|
234
|
-
document.head.appendChild(script);
|
|
235
|
-
}
|
|
236
226
|
win.importMap = importMap;
|
|
227
|
+
if (enableShim && !!window?.esmsInitOptions?.shimMode) {
|
|
228
|
+
try {
|
|
229
|
+
win.importShim.addImportMap(importMap);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
// ignore error
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// fallback to create script tag
|
|
237
|
+
const script = document.createElement('script');
|
|
238
|
+
script.type = 'importmap';
|
|
239
|
+
script.textContent = JSON.stringify(importMap, null, 2);
|
|
240
|
+
document.head.appendChild(script);
|
|
237
241
|
};
|
|
238
242
|
setupImportMap();
|
|
239
243
|
}
|