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'
    },

  ],
  
});

相關文章