fix
This commit is contained in:
		@@ -1,7 +1,7 @@
 | 
				
			|||||||
// 生成缓存键,基于当前模块的URL
 | 
					 | 
				
			||||||
const getCacheKey = () => {
 | 
					const getCacheKey = () => {
 | 
				
			||||||
  const url = new URL(import.meta.url);
 | 
					  // 基于import map文件的路径,而不是当前模块的URL
 | 
				
			||||||
  const basePath = url.pathname.replace('/import-map.js', '');
 | 
					  const url = new URL('./imports.json', window.location.href);
 | 
				
			||||||
 | 
					  const basePath = url.pathname.replace('/imports.json', '');
 | 
				
			||||||
  return `importMap_${btoa(basePath).replace(/[+/=]/g, '_')}`;
 | 
					  return `importMap_${btoa(basePath).replace(/[+/=]/g, '_')}`;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
const getCurrentScriptData = () => {
 | 
					const getCurrentScriptData = () => {
 | 
				
			||||||
@@ -121,8 +121,17 @@ export const updateCacheInBackground = async () => {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const runMain = async () => {
 | 
					const runMain = async () => {
 | 
				
			||||||
  const { render } = await import('main');
 | 
					  const sourceCode = `
 | 
				
			||||||
  render();
 | 
					  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 () => {
 | 
					const main = async () => {
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "@kevisual/native",
 | 
					  "name": "@kevisual/native",
 | 
				
			||||||
  "version": "0.0.1",
 | 
					  "version": "0.0.4",
 | 
				
			||||||
  "description": "",
 | 
					  "description": "",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "files": [
 | 
					  "files": [
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user