umi4 在index.html中添加脚本和样式

liuyong111 / 2024-09-26 / 原文

在.umirc.ts中增加配置

import { defineConfig } from "umi";
import HtmlWebpackPlugin from 'html-webpack-plugin';

export default defineConfig({
  
  styles: [
    { content: `#root{height:100%}` },
    { content: `html{height:100%}` },
    { content: `body{height:100%}` },
  ],
  headScripts: [
    {
      content: `function plusReady() {}`, type: 'text/javascript'
    },

  ],
  
});