html.ts 323 B

12345678910111213
  1. import type { Plugin } from 'vite';
  2. export function setupHtmlPlugin(buildTime: string) {
  3. const plugin: Plugin = {
  4. name: 'html-plugin',
  5. apply: 'build',
  6. transformIndexHtml(html) {
  7. return html.replace('<head>', `<head>\n <meta name="buildTime" content="${buildTime}">`);
  8. }
  9. };
  10. return plugin;
  11. }