فهرست منبع

build: 静态文件夹创建

王晓东 2 ماه پیش
والد
کامیت
4366668222
2فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 1 0
      public/test.html
  2. 9 0
      vite.config.ts

+ 1 - 0
public/test.html

@@ -0,0 +1 @@
+<h1>hello</h1>

+ 9 - 0
vite.config.ts

@@ -1,6 +1,8 @@
 import path from 'path';
 import { defineConfig, loadEnv } from 'vite';
 import react from '@vitejs/plugin-react';
+import { resolve } from 'path';
+
 
 export default defineConfig(({ mode }) => {
     const env = loadEnv(mode, process.cwd())
@@ -11,6 +13,13 @@ export default defineConfig(({ mode }) => {
         host: '0.0.0.0',
       },
       plugins: [react()],
+      build: {
+          rollupOptions: {
+            input: {
+              main: resolve(__dirname, '/index.html'), // React SPA 入口
+            }
+          }
+        },
       define: {
         'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
         'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)