fix
This commit is contained in:
parent
0bfa055056
commit
1d0df822ce
@ -1,7 +1,7 @@
|
||||
// 生成缓存键,基于当前模块的URL
|
||||
const getCacheKey = () => {
|
||||
const url = new URL(import.meta.url);
|
||||
const basePath = url.pathname.replace('/import-map.js', '');
|
||||
// 基于import map文件的路径,而不是当前模块的URL
|
||||
const url = new URL('./imports.json', window.location.href);
|
||||
const basePath = url.pathname.replace('/imports.json', '');
|
||||
return `importMap_${btoa(basePath).replace(/[+/=]/g, '_')}`;
|
||||
};
|
||||
const getCurrentScriptData = () => {
|
||||
@ -121,8 +121,17 @@ export const updateCacheInBackground = async () => {
|
||||
};
|
||||
|
||||
const runMain = async () => {
|
||||
const { render } = await import('main');
|
||||
render();
|
||||
const sourceCode = `
|
||||
import { render } from 'main';
|
||||
render();`;
|
||||
try {
|
||||
const script = document.createElement('script');
|
||||
script.type = 'module';
|
||||
script.textContent = sourceCode;
|
||||
document.body.appendChild(script);
|
||||
} catch (error) {
|
||||
console.error('Error executing source code:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const main = async () => {
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@kevisual/native",
|
||||
"version": "0.0.1",
|
||||
"version": "0.0.4",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user