|
|
@@ -127,7 +127,7 @@ export function progressTrackingPlugin() {
|
|
|
// 如果3秒内没有新的服务端活动,认为服务端编译已完成或无需编译
|
|
|
serverActivityTimer = setTimeout(() => {
|
|
|
if (serverProgress === 0) {
|
|
|
- console.log('No server compilation detected - using client-only mode');
|
|
|
+ // console.log('No server compilation detected - using client-only mode');
|
|
|
hasServerActivity = false;
|
|
|
}
|
|
|
}, 3000);
|
|
|
@@ -139,17 +139,17 @@ export function progressTrackingPlugin() {
|
|
|
const timeSinceLastResource = now - lastResourceTime;
|
|
|
|
|
|
// 添加详细的调试日志
|
|
|
- console.log('=== checkCompletion Debug ===');
|
|
|
- console.log('hasServerActivity:', hasServerActivity);
|
|
|
- console.log('serverProgress:', serverProgress);
|
|
|
- console.log('resourcesCompleted:', resourcesCompleted);
|
|
|
- console.log('estimatedTotal:', estimatedTotal);
|
|
|
- console.log('timeSinceLastResource:', timeSinceLastResource);
|
|
|
- console.log('isLoading:', isLoading);
|
|
|
+ // console.log('=== checkCompletion Debug ===');
|
|
|
+ // console.log('hasServerActivity:', hasServerActivity);
|
|
|
+ // console.log('serverProgress:', serverProgress);
|
|
|
+ // console.log('resourcesCompleted:', resourcesCompleted);
|
|
|
+ // console.log('estimatedTotal:', estimatedTotal);
|
|
|
+ // console.log('timeSinceLastResource:', timeSinceLastResource);
|
|
|
+ // console.log('isLoading:', isLoading);
|
|
|
|
|
|
// 如果已经不在加载状态,直接返回
|
|
|
if (!isLoading) {
|
|
|
- console.log('⚠️ Not loading anymore, exiting checkCompletion');
|
|
|
+ // console.log('⚠️ Not loading anymore, exiting checkCompletion');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -157,14 +157,14 @@ export function progressTrackingPlugin() {
|
|
|
if (!hasServerActivity) {
|
|
|
// 无服务端编译时,主要依赖客户端资源
|
|
|
if (resourcesCompleted >= estimatedTotal * 0.8 && timeSinceLastResource > 2000) {
|
|
|
- console.log('Client-only loading complete');
|
|
|
+ // console.log('Client-only loading complete');
|
|
|
forceComplete();
|
|
|
return;
|
|
|
}
|
|
|
} else {
|
|
|
// 有服务端编译时,需要服务端完成
|
|
|
if (serverProgress >= 1.0 && timeSinceLastResource > 2000) {
|
|
|
- console.log('Server + client loading complete');
|
|
|
+ // console.log('Server + client loading complete');
|
|
|
forceComplete();
|
|
|
return;
|
|
|
}
|
|
|
@@ -172,7 +172,7 @@ export function progressTrackingPlugin() {
|
|
|
|
|
|
// 超时强制完成
|
|
|
if (timeSinceLastResource > 1000 * 10) {
|
|
|
- console.log('Force completing due to timeout');
|
|
|
+ // console.log('Force completing due to timeout');
|
|
|
forceComplete();
|
|
|
}
|
|
|
|
|
|
@@ -191,7 +191,7 @@ export function progressTrackingPlugin() {
|
|
|
statusDisplay.style.display = 'none';
|
|
|
progressBar.classList.add('complete');
|
|
|
|
|
|
- console.log('Loading completed!');
|
|
|
+ // console.log('Loading completed!');
|
|
|
|
|
|
setTimeout(() => {
|
|
|
progressBar.style.display = 'none';
|
|
|
@@ -210,7 +210,7 @@ export function progressTrackingPlugin() {
|
|
|
Math.min(resourcesCompleted / estimatedTotal, 1.0) : 0;
|
|
|
totalProgress = clientProgress * 100;
|
|
|
|
|
|
- console.log(\`Client-only mode: \${resourcesCompleted}/\${estimatedTotal} resources\`);
|
|
|
+ // console.log(\`Client-only mode: \${resourcesCompleted}/\${estimatedTotal} resources\`);
|
|
|
} else {
|
|
|
// 有服务端编译活动,使用混合权重
|
|
|
const serverWeight = serverProgress < 1.0 ? 0.6 : 0.3;
|
|
|
@@ -222,7 +222,7 @@ export function progressTrackingPlugin() {
|
|
|
|
|
|
totalProgress = (serverPart + clientPart) * 100;
|
|
|
|
|
|
- console.log(\`Mixed mode: Server \${Math.round(serverProgress * 100)}%, Client \${resourcesCompleted}/\${estimatedTotal}\`);
|
|
|
+ // console.log(\`Mixed mode: Server \${Math.round(serverProgress * 100)}%, Client \${resourcesCompleted}/\${estimatedTotal}\`);
|
|
|
}
|
|
|
|
|
|
// 确保进度不会倒退
|
|
|
@@ -238,7 +238,7 @@ export function progressTrackingPlugin() {
|
|
|
statusDisplay.textContent =
|
|
|
\`Loading... \${Math.round(totalProgress)}% (\${mode}: \${resourcesCompleted}/\${estimatedTotal})\`;
|
|
|
|
|
|
- console.log(\`Progress: Total \${Math.round(totalProgress)}%\`);
|
|
|
+ // console.log(\`Progress: Total \${Math.round(totalProgress)}%\`);
|
|
|
|
|
|
// 如果接近完成,开始检测完成状态
|
|
|
if (totalProgress >= 90) {
|
|
|
@@ -279,7 +279,7 @@ export function progressTrackingPlugin() {
|
|
|
estimatedTotal = Math.max(estimatedTotal, resourcesCompleted + 3);
|
|
|
}
|
|
|
|
|
|
- console.log(\`Resource completed: \${entry.name} (type: \${entry.initiatorType})\`);
|
|
|
+ // console.log(\`Resource completed: \${entry.name} (type: \${entry.initiatorType})\`);
|
|
|
updateProgress();
|
|
|
}
|
|
|
}
|
|
|
@@ -293,7 +293,7 @@ export function progressTrackingPlugin() {
|
|
|
function initialize() {
|
|
|
estimatedTotal = estimateResourceCount();
|
|
|
lastResourceTime = Date.now();
|
|
|
- console.log(\`Estimated total resources: \${estimatedTotal}\`);
|
|
|
+ // console.log(\`Estimated total resources: \${estimatedTotal}\`);
|
|
|
|
|
|
// 显示初始状态
|
|
|
if (statusDisplay) {
|
|
|
@@ -306,7 +306,7 @@ export function progressTrackingPlugin() {
|
|
|
// 启动服务端活动检测
|
|
|
setTimeout(() => {
|
|
|
if (!hasServerActivity) {
|
|
|
- console.log('No server activity detected, switching to client-only mode');
|
|
|
+ // console.log('No server activity detected, switching to client-only mode');
|
|
|
updateProgress();
|
|
|
}
|
|
|
}, 1000);
|
|
|
@@ -317,7 +317,7 @@ export function progressTrackingPlugin() {
|
|
|
setTimeout(() => {
|
|
|
if (resourcesCompleted > 0) {
|
|
|
estimatedTotal = Math.max(resourcesCompleted + 2, estimatedTotal);
|
|
|
- console.log(\`Final estimated total: \${estimatedTotal}\`);
|
|
|
+ // console.log(\`Final estimated total: \${estimatedTotal}\`);
|
|
|
}
|
|
|
updateProgress();
|
|
|
|
|
|
@@ -341,7 +341,7 @@ export function progressTrackingPlugin() {
|
|
|
|
|
|
// HMR 更新时重置状态
|
|
|
import.meta.hot.on('vite:beforeUpdate', () => {
|
|
|
- console.log('HMR update detected, maintaining progress tracking...');
|
|
|
+ // console.log('HMR update detected, maintaining progress tracking...');
|
|
|
});
|
|
|
}
|
|
|
`,
|