添加配置浏览器缓存所有静态资源

This commit is contained in:
eoao
2025-08-26 23:44:22 +08:00
parent 00fd14ad88
commit fc0a5564f4
59 changed files with 81 additions and 95 deletions

3
mail-vue/public/_headers Normal file
View File

@@ -0,0 +1,3 @@
/assets/*
/tinymce/*
Cache-Control: public, max-age=31556952, immutable

View File

@@ -55,21 +55,7 @@ export async function init() {
document.title = setting.title;
}
if (!setting.background) {
removeLoading();
return;
}
const img = new Image();
img.src = cvtR2Url(setting.background);
img.onload = () => {
removeLoading();
};
img.onerror = () => {
console.warn('背景图片加载失败:', img.src);
removeLoading();
};
removeLoading();
}
function removeLoading() {

View File

@@ -31,15 +31,7 @@ export default defineConfig(({mode}) => {
target: 'es2022',
outDir: '../mail-worker/dist',
emptyOutDir: true,
assetsInclude: ['**/*.json'],
rollupOptions: {
output: {
// 保证 chunk 文件名可预测
chunkFileNames: 'assets/[name]-[hash].js',
entryFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name]-[hash].[ext]'
}
}
assetsInclude: ['**/*.json']
}
}
})