Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cef15c032 | ||
|
|
970d1ac3ed |
@@ -65,8 +65,8 @@
|
|||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
|
||||||
<!-- Cloudflare Web Analytics -->
|
<!-- Cloudflare Web Analytics - Only in Production -->
|
||||||
<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "2aecdc025eb043bc89ce931b54a80054"}'></script>
|
<!--CLOUDFLARE_ANALYTICS_PLACEHOLDER-->
|
||||||
<!-- End Cloudflare Web Analytics -->
|
<!-- End Cloudflare Web Analytics -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "litek",
|
"name": "litek",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.31",
|
"version": "0.0.32",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -5,10 +5,20 @@ import tailwindcss from "@tailwindcss/vite"
|
|||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from 'vite-plugin-pwa'
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => ({
|
||||||
plugins: [
|
plugins: [
|
||||||
react(),
|
react(),
|
||||||
tailwindcss(),
|
tailwindcss(),
|
||||||
|
// HTML 替换插件 - 仅在生产环境注入 Cloudflare Analytics
|
||||||
|
{
|
||||||
|
name: 'html-transform',
|
||||||
|
transformIndexHtml(html) {
|
||||||
|
const cloudflareScript = mode === 'production'
|
||||||
|
? `<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "2aecdc025eb043bc89ce931b54a80054"}'></script>`
|
||||||
|
: '';
|
||||||
|
return html.replace('<!--CLOUDFLARE_ANALYTICS_PLACEHOLDER-->', cloudflareScript);
|
||||||
|
}
|
||||||
|
},
|
||||||
VitePWA({
|
VitePWA({
|
||||||
registerType: 'autoUpdate',
|
registerType: 'autoUpdate',
|
||||||
includeAssets: ['lite.svg', 'robots.txt', 'sitemap.xml'],
|
includeAssets: ['lite.svg', 'robots.txt', 'sitemap.xml'],
|
||||||
@@ -130,4 +140,4 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
chunkSizeWarningLimit: 500,
|
chunkSizeWarningLimit: 500,
|
||||||
},
|
},
|
||||||
})
|
}))
|
||||||
|
|||||||
Reference in New Issue
Block a user