From 6f7b2e043e096314ded35eae92b5e709cf872bc2 Mon Sep 17 00:00:00 2001 From: allence Date: Thu, 27 Apr 2023 16:00:11 +0800 Subject: [PATCH] chore(web): vite support dot path (#1093) * chore(web): Vite support dot path * style(web): homepage icon size --- web/package-lock.json | 42 +++++++++++++++++++++++++- web/package.json | 3 +- web/src/components/CommonIcon/index.ts | 4 +-- web/src/pages/homepage/language.tsx | 2 +- web/src/pages/homepage/navbar.tsx | 6 +++- web/vite.config.ts | 3 +- 6 files changed, 53 insertions(+), 7 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index 79fb8bdf3e..eb564ac6ad 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -60,7 +60,8 @@ "prettier-plugin-tailwindcss": "^0.2.6", "tailwindcss": "^3.3.1", "typescript": "5.0.3", - "vite": "^4.2.1" + "vite": "^4.2.1", + "vite-plugin-rewrite-all": "^1.0.1" } }, "node_modules/@ampproject/remapping": { @@ -5242,6 +5243,15 @@ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, + "node_modules/connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true, + "engines": { + "node": ">=0.8" + } + }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -9835,6 +9845,21 @@ } } }, + "node_modules/vite-plugin-rewrite-all": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/vite-plugin-rewrite-all/-/vite-plugin-rewrite-all-1.0.1.tgz", + "integrity": "sha512-W0DAchC8ynuQH0lYLIu5/5+JGfYlUTRD8GGNtHFXRJX4FzzB9MajtqHBp26zq/ly9sDt5BqrfdT08rv3RbB0LQ==", + "dev": true, + "dependencies": { + "connect-history-api-fallback": "^1.6.0" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "vite": "^2.0.0 || ^3.0.0 || ^4.0.0" + } + }, "node_modules/void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", @@ -13657,6 +13682,12 @@ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", "dev": true }, + "connect-history-api-fallback": { + "version": "1.6.0", + "resolved": "https://registry.npmmirror.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", + "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", + "dev": true + }, "convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", @@ -16897,6 +16928,15 @@ "rollup": "^3.18.0" } }, + "vite-plugin-rewrite-all": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/vite-plugin-rewrite-all/-/vite-plugin-rewrite-all-1.0.1.tgz", + "integrity": "sha512-W0DAchC8ynuQH0lYLIu5/5+JGfYlUTRD8GGNtHFXRJX4FzzB9MajtqHBp26zq/ly9sDt5BqrfdT08rv3RbB0LQ==", + "dev": true, + "requires": { + "connect-history-api-fallback": "^1.6.0" + } + }, "void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", diff --git a/web/package.json b/web/package.json index a7240dbb4d..558ecc93af 100644 --- a/web/package.json +++ b/web/package.json @@ -65,7 +65,8 @@ "prettier-plugin-tailwindcss": "^0.2.6", "tailwindcss": "^3.3.1", "typescript": "5.0.3", - "vite": "^4.2.1" + "vite": "^4.2.1", + "vite-plugin-rewrite-all": "^1.0.1" }, "lint-staged": { "*.{ts,tsx}": [ diff --git a/web/src/components/CommonIcon/index.ts b/web/src/components/CommonIcon/index.ts index fd9c5aba93..e1f2273fc7 100644 --- a/web/src/components/CommonIcon/index.ts +++ b/web/src/components/CommonIcon/index.ts @@ -26,13 +26,13 @@ export const DarkModeIcon = createIcon({ export const LangIcon = createIcon({ displayName: "LangIcon", - viewBox: "0 0 24 24", + viewBox: "0 0 20 20", d: "M10 18.3333C5.39752 18.3333 1.66669 14.6025 1.66669 9.99996C1.66669 5.39746 5.39752 1.66663 10 1.66663C14.6025 1.66663 18.3334 5.39746 18.3334 9.99996C18.3334 14.6025 14.6025 18.3333 10 18.3333ZM8.09169 16.3891C7.26953 14.6452 6.79325 12.7585 6.68919 10.8333H3.38502C3.54718 12.1157 4.07829 13.3234 4.91383 14.3097C5.74937 15.296 6.85336 16.0184 8.09169 16.3891ZM8.35835 10.8333C8.48419 12.8658 9.06502 14.775 10 16.46C10.9603 14.7304 11.5212 12.8079 11.6417 10.8333H8.35835ZM16.615 10.8333H13.3109C13.2068 12.7585 12.7305 14.6452 11.9084 16.3891C13.1467 16.0184 14.2507 15.296 15.0862 14.3097C15.9218 13.3234 16.4529 12.1157 16.615 10.8333ZM3.38502 9.16663H6.68919C6.79325 7.24145 7.26953 5.3547 8.09169 3.61079C6.85336 3.98153 5.74937 4.70392 4.91383 5.69021C4.07829 6.67649 3.54718 7.88421 3.38502 9.16663ZM8.35919 9.16663H11.6409C11.5206 7.19212 10.96 5.26957 10 3.53996C9.03975 5.2695 8.47882 7.19206 8.35835 9.16663H8.35919ZM11.9084 3.61079C12.7305 5.3547 13.2068 7.24145 13.3109 9.16663H16.615C16.4529 7.88421 15.9218 6.67649 15.0862 5.69021C14.2507 4.70392 13.1467 3.98153 11.9084 3.61079Z", }); export const GithubIcon = createIcon({ displayName: "GithubIcon", - viewBox: "0 0 24 24", + viewBox: "0 0 20 20", d: "M9.99996 1.66663C5.39579 1.66663 1.66663 5.39579 1.66663 9.99996C1.66568 11.7494 2.21564 13.4546 3.23847 14.8739C4.26131 16.2931 5.70508 17.3542 7.36496 17.9066C7.78163 17.9791 7.93746 17.7291 7.93746 17.51C7.93746 17.3125 7.92663 16.6566 7.92663 15.9583C5.83329 16.3441 5.29163 15.4483 5.12496 14.9791C5.03079 14.7391 4.62496 14 4.27079 13.8016C3.97913 13.6458 3.56246 13.26 4.25996 13.25C4.91663 13.2391 5.38496 13.8541 5.54163 14.1041C6.29163 15.3641 7.48996 15.01 7.96829 14.7916C8.04163 14.25 8.25996 13.8858 8.49996 13.6775C6.64579 13.4691 4.70829 12.75 4.70829 9.56246C4.70829 8.65579 5.03079 7.90663 5.56246 7.32246C5.47913 7.11413 5.18746 6.25996 5.64579 5.11413C5.64579 5.11413 6.34329 4.89579 7.93746 5.96913C8.61585 5.78084 9.31677 5.68608 10.0208 5.68746C10.7291 5.68746 11.4375 5.78079 12.1041 5.96829C13.6975 4.88496 14.3958 5.11496 14.3958 5.11496C14.8541 6.26079 14.5625 7.11496 14.4791 7.32329C15.01 7.90663 15.3333 8.64579 15.3333 9.56246C15.3333 12.7608 13.3858 13.4691 11.5316 13.6775C11.8333 13.9375 12.0941 14.4375 12.0941 15.2191C12.0941 16.3333 12.0833 17.2291 12.0833 17.5108C12.0833 17.7291 12.24 17.9891 12.6566 17.9058C14.3108 17.3473 15.7482 16.2841 16.7665 14.8659C17.7849 13.4477 18.3328 11.7459 18.3333 9.99996C18.3333 5.39579 14.6041 1.66663 9.99996 1.66663Z", }); diff --git a/web/src/pages/homepage/language.tsx b/web/src/pages/homepage/language.tsx index f6818feb55..57c7d2d3e4 100644 --- a/web/src/pages/homepage/language.tsx +++ b/web/src/pages/homepage/language.tsx @@ -26,7 +26,7 @@ const Language = (props: Props) => { src={darkMode ? "/homepage/dark/language.svg" : "/homepage/language.svg"} alt="language" /> */} - +

{i18n.language === "en" ? "中文" : "English"}

diff --git a/web/src/pages/homepage/navbar.tsx b/web/src/pages/homepage/navbar.tsx index 7186621803..8a8bfded38 100644 --- a/web/src/pages/homepage/navbar.tsx +++ b/web/src/pages/homepage/navbar.tsx @@ -145,7 +145,11 @@ const Navbar = (props: Props) => { className="flex" rel="noreferrer" > - + {stars} ) : null} diff --git a/web/vite.config.ts b/web/vite.config.ts index ab49fc9c60..cbd3ecb18e 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -1,6 +1,7 @@ import react from "@vitejs/plugin-react-swc"; import path from "path"; import { defineConfig, loadEnv } from "vite"; +import pluginRewriteAll from "vite-plugin-rewrite-all"; // https://vitejs.dev/config/ export default defineConfig(({ command, mode }) => { @@ -16,7 +17,7 @@ export default defineConfig(({ command, mode }) => { }, }, }, - plugins: [react()], + plugins: [react(), pluginRewriteAll()], resolve: { alias: { "@": path.resolve(__dirname, "./src"),