feat: init

This commit is contained in:
2025-09-05 15:18:10 +08:00
parent ddbee614e8
commit 85244a451e
126 changed files with 3020 additions and 10278 deletions

View File

@@ -1,9 +1,9 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";
import path, { resolve } from "path";
import { inspectorServer } from "@react-dev-inspector/vite-plugin";
import basicSsl from "@vitejs/plugin-basic-ssl";
export default defineConfig({
// plugins: [react()],
plugins: [react(), basicSsl()],
server: {
https: {},
@@ -11,6 +11,29 @@ export default defineConfig({
host: "0.0.0.0",
open: true,
},
css: {
modules: {
generateScopedName: () => {
if (process.env.NODE_ENV === "production") {
return `[hash:base64:8]`;
}
return `[name]__[local]___[hash:base64:5]`;
},
},
preprocessorOptions: {
less: {
// 全局变量
// additionalData: `@import "${resolve(__dirname, "src/styles/variables.less")}";`,
// Less 选项
javascriptEnabled: true,
modifyVars: {
// 可以在这里定义全局变量
"@primary-color": "#1890ff",
"@border-radius-base": "6px",
},
},
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
@@ -19,6 +42,17 @@ export default defineConfig({
"@utils": path.resolve(__dirname, "../../packages/utils/src"),
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ["react", "react-dom"],
router: ["react-router-dom"],
},
},
},
chunkSizeWarningLimit: 1000,
},
optimizeDeps: {
include: ["@shared", "@hooks", "@utils"],
},