From 4c7aeefefe7ee83b0499fd20533df2d6e8a10eea Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Fri, 8 Mar 2024 11:24:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9E=84=E5=BB=BA=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E9=9A=90=E8=97=8F=E5=9C=A8=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + vite.config.js | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 9577809..c1afad7 100644 --- a/index.html +++ b/index.html @@ -9,5 +9,6 @@
+

BUILD_DATE: %BUILD_DATE%

diff --git a/vite.config.js b/vite.config.js index a5b5f14..8659be5 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,9 +2,21 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import WindiCSS from 'vite-plugin-windicss' +const buildDatePlugin = () => { + return { + transformIndexHtml(html) { + const dataString = new Date().toISOString() + return html.replace( + /%BUILD_DATE%/, + `${dataString}`, + ) + }, + } +} + // https://vitejs.dev/config/ export default defineConfig({ - plugins: [react(), WindiCSS()], + plugins: [react(), WindiCSS(), buildDatePlugin()], server: { host: "0.0.0.0", }, @@ -30,5 +42,8 @@ export default defineConfig({ // } // } // } + }, + terserOptions: { + maxWorkers: 4 } })