fix
This commit is contained in:
		@@ -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": [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user