chore: 更新工具链与项目配置
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ae021f06d1
commit
77742d5b02
11 files changed
+393
-196
No files matched your search
+47
-2
@@ -1,16 +1,61 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { defineConfig } from "vite";
|
||||
import { defineConfig, type Plugin } from "vite";
|
||||
import { appConfig } from "./src/app.config";
|
||||
|
||||
function createHtmlConfigPlugin(): Plugin {
|
||||
const viewport = [
|
||||
`width=${appConfig.viewport.width}`,
|
||||
`initial-scale=${appConfig.viewport.initialScale}`,
|
||||
`minimum-scale=${appConfig.viewport.minimumScale}`,
|
||||
`maximum-scale=${appConfig.viewport.maximumScale}`,
|
||||
].join(", ");
|
||||
|
||||
return {
|
||||
name: "html-config",
|
||||
transformIndexHtml(html) {
|
||||
return {
|
||||
html: html
|
||||
.replaceAll("%APP_TITLE%", appConfig.title)
|
||||
.replaceAll("%APP_DESCRIPTION%", appConfig.description)
|
||||
.replaceAll("%APP_FAVICON%", appConfig.favicon)
|
||||
.replaceAll("%APP_VIEWPORT%", viewport),
|
||||
tags: [
|
||||
{
|
||||
tag: "script",
|
||||
attrs: {
|
||||
src: "./videoajax/jquery-3.7.1.min.js",
|
||||
},
|
||||
injectTo: "head",
|
||||
},
|
||||
{
|
||||
tag: "script",
|
||||
attrs: {
|
||||
src: "./videoajax/videoajax.js",
|
||||
},
|
||||
injectTo: "head",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
base: "./",
|
||||
plugins: [react(), createHtmlConfigPlugin()],
|
||||
resolve: {
|
||||
dedupe: ["react", "react-dom"],
|
||||
alias: {
|
||||
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: ["react", "react-dom", "@dnd-kit/core", "@dnd-kit/utilities"],
|
||||
},
|
||||
server: {
|
||||
// 允许局域网设备访问,便于移动端真机调试;如不需要可改为 localhost。
|
||||
host: true,
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user