增加构建日期隐藏在页面

dev/mobile
Jimmy Liow 2 years ago
parent fa35237b22
commit 4c7aeefefe

@ -9,5 +9,6 @@
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
<p style="display: none;">BUILD_DATE: %BUILD_DATE%</p>
</body>
</html>

@ -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
}
})

Loading…
Cancel
Save