generated from zhongyidian/yx-react-template
Initial commit
This commit is contained in:
commit
6b1e803320
158 files changed
+16461
No files matched your search
@@ -0,0 +1,61 @@
|
||||
import { fileURLToPath } from "node:url";
|
||||
import react from "@vitejs/plugin-react";
|
||||
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({
|
||||
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