diff --git a/apps/index.html b/apps/index.html
index 480eb84..33d34a9 100644
--- a/apps/index.html
+++ b/apps/index.html
@@ -14,19 +14,6 @@
<%= VITE_APP_TITLE %>
-
diff --git a/apps/vite.config.ts b/apps/vite.config.ts
index b5734a8..b85fe9a 100644
--- a/apps/vite.config.ts
+++ b/apps/vite.config.ts
@@ -8,6 +8,37 @@ const DEV_INTERNAL_GOLANG_TARGET = 'http://127.0.0.1:2900';
const DEV_PROD_GOLANG_TARGET = 'https://jvapi.haiyihy.com';
const DEV_PROD_TARGET = 'https://yumi-admin.haiyihy.com';
+function getBundledAssetFileName(assetInfo: {
+ name?: string;
+ names?: string[];
+}) {
+ const names = [
+ assetInfo.name,
+ ...(Array.isArray(assetInfo.names) ? assetInfo.names : []),
+ ]
+ .filter(Boolean)
+ .join(',');
+
+ if (names.endsWith('.css') || names.includes('.css,')) {
+ return 'css/app.css';
+ }
+
+ return '[ext]/[name]-[hash].[ext]';
+}
+
+function addBuildTimestampToBundledAssets() {
+ const buildTimestamp = Date.now().toString();
+
+ return {
+ name: 'chatapp-build-asset-timestamp',
+ transformIndexHtml(html: string) {
+ return html
+ .replaceAll('/js/app.js"', `/js/app.js?v=${buildTimestamp}"`)
+ .replaceAll('/css/app.css"', `/css/app.css?v=${buildTimestamp}"`);
+ },
+ };
+}
+
function createPrefixRegExp(prefix: string) {
return new RegExp(`^${prefix.replaceAll('/', '\\/')}`);
}
@@ -16,6 +47,19 @@ export default defineConfig(async () => {
return {
application: {},
vite: {
+ build: {
+ cssCodeSplit: false,
+ modulePreload: false,
+ rolldownOptions: {
+ output: {
+ assetFileNames: getBundledAssetFileName,
+ chunkFileNames: 'js/[name]-[hash].js',
+ codeSplitting: false,
+ entryFileNames: 'js/app.js',
+ },
+ },
+ },
+ plugins: [addBuildTimestampToBundledAssets()],
server: {
proxy: {
[`${DEV_API_INTERNAL_PREFIX}/go`]: {