Skip to content

Commit

Permalink
feat: 🐣 更新package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
iamzwq committed Nov 11, 2024
1 parent 69d2297 commit 20cc6c2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 41 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"build": "tsc -b && vite build --base=/react-temp-admin",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier --write '**/*.{js,ts,jsx,tsx}'",
Expand Down Expand Up @@ -61,4 +61,4 @@
"npm run lint:fix"
]
}
}
}
2 changes: 1 addition & 1 deletion tsconfig.app.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/antd-config-provider/index.tsx","./src/components/error-boundary/index.tsx","./src/components/loading-indicator/index.tsx","./src/components/progress-bar/index.tsx","./src/components/react-echarts/index.tsx","./src/components/react-echarts/library.ts","./src/components/slide-fade/index.tsx","./src/components/static-antd/index.tsx","./src/components/theme-provider/index.tsx","./src/components/theme-switch/index.tsx","./src/hooks/index.ts","./src/hooks/use-click-dbclick.ts","./src/hooks/use-debounced-fn.ts","./src/hooks/use-document-visibility.ts","./src/hooks/use-event-listener.ts","./src/hooks/use-in-viewport.ts","./src/hooks/use-memoized-fn.ts","./src/hooks/use-mounted.ts","./src/hooks/use-previous.ts","./src/layouts/index.tsx","./src/layouts/components/breadcrumb.tsx","./src/layouts/components/content.tsx","./src/layouts/components/custom-skin.tsx","./src/layouts/components/sider.tsx","./src/layouts/components/user-avatar.tsx","./src/pages/echarts-demo/layout.tsx","./src/pages/echarts-demo/routes.tsx","./src/pages/echarts-demo/components/bar-chart.tsx","./src/pages/landing/index.tsx","./src/pages/landing/routes.tsx","./src/pages/login/api.ts","./src/pages/login/index.tsx","./src/pages/login/components/login-form.tsx","./src/pages/login/components/third-party-login.tsx","./src/pages/nav/index.tsx","./src/pages/nav/routes.tsx","./src/pages/nav/sub-nav-1/index.tsx","./src/pages/nav/sub-nav-2/index.tsx","./src/pages/not-found/index.tsx","./src/pages/user-management/api.ts","./src/pages/user-management/index.tsx","./src/pages/user-management/routes.tsx","./src/pages/user-management/types.ts","./src/pages/user-management/components/edit-button.tsx","./src/pages/user-management/components/edit-form.tsx","./src/pages/user-management/components/edit-modal.tsx","./src/router/index.tsx","./src/stores/settings.ts","./src/utils/antd.ts","./src/utils/array.ts","./src/utils/date.ts","./src/utils/debounce-throttle.ts","./src/utils/index.ts","./src/utils/is.ts","./src/utils/object.ts","./src/utils/string.ts","./src/utils/tailwind.ts","./src/utils/url.ts","./src/utils/userequest.ts"],"version":"5.6.3"}
{"root":["./src/app.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/components/antd-config-provider/index.tsx","./src/components/error-boundary/index.tsx","./src/components/loading-indicator/index.tsx","./src/components/progress-bar/index.tsx","./src/components/react-echarts/index.tsx","./src/components/react-echarts/library.ts","./src/components/slide-fade/index.tsx","./src/components/static-antd/index.tsx","./src/components/theme-provider/index.tsx","./src/components/theme-switch/index.tsx","./src/hooks/index.ts","./src/hooks/use-click-dbclick.ts","./src/hooks/use-debounced-fn.ts","./src/hooks/use-document-visibility.ts","./src/hooks/use-event-listener.ts","./src/hooks/use-in-viewport.ts","./src/hooks/use-memoized-fn.ts","./src/hooks/use-mounted.ts","./src/hooks/use-previous.ts","./src/layouts/index.tsx","./src/layouts/components/breadcrumb.tsx","./src/layouts/components/content.tsx","./src/layouts/components/custom-skin.tsx","./src/layouts/components/sider.tsx","./src/layouts/components/user-avatar.tsx","./src/pages/echarts-demo/layout.tsx","./src/pages/echarts-demo/routes.tsx","./src/pages/echarts-demo/components/bar-chart.tsx","./src/pages/landing/index.tsx","./src/pages/landing/routes.tsx","./src/pages/login/api.ts","./src/pages/login/index.tsx","./src/pages/login/components/login-form.tsx","./src/pages/login/components/third-party-login.tsx","./src/pages/nav/index.tsx","./src/pages/nav/routes.tsx","./src/pages/nav/sub-nav-1/index.tsx","./src/pages/nav/sub-nav-2/index.tsx","./src/pages/not-found/index.tsx","./src/pages/user-management/api.ts","./src/pages/user-management/index.tsx","./src/pages/user-management/routes.tsx","./src/pages/user-management/types.ts","./src/pages/user-management/components/edit-button.tsx","./src/pages/user-management/components/edit-form.tsx","./src/pages/user-management/components/edit-modal.tsx","./src/router/index.tsx","./src/stores/settings.ts","./src/types/global.d.ts","./src/utils/array.ts","./src/utils/date.ts","./src/utils/debounce-throttle.ts","./src/utils/index.ts","./src/utils/is.ts","./src/utils/object.ts","./src/utils/string.ts","./src/utils/tailwind.ts","./src/utils/url.ts","./src/utils/userequest.ts"],"version":"5.6.3"}
73 changes: 35 additions & 38 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,45 @@ import svgr from "vite-plugin-svgr";
import react from "@vitejs/plugin-react-swc";

// https://vitejs.dev/config/
export default defineConfig(({ command }) => {
return {
base: command === "build" ? "/react-temp-admin/" : "/",
plugins: [
react(),
{ ...compression(), apply: "build" },
svgr({
svgrOptions: {
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
svgoConfig: {
floatPrecision: 2,
},
export default defineConfig({
plugins: [
react(),
{ ...compression(), apply: "build" },
svgr({
svgrOptions: {
plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"],
svgoConfig: {
floatPrecision: 2,
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
build: {
// 默认 esbuild minify,而 esbuild 不仅会做压缩,
// 而且还会在 target 配置允许的范围内做一些语法转换(例如把低版本语法转为高版本)
// 尽可能减小 bundle 体积。最关键的是,esbuild 的 target 默认 esnext
// 这种情况下,即使你用 Babel、PostCSS 等工具做语法转换,也很难保证 esbuild 不会给你转换成高版本语法
// (因为代码压缩总是最后一步)。
// 由于 esbuild 最低只支持 es2015,如果需要支持更低版本浏览器,则可以改用 terser 压缩
// minify: "terser",
target: "es2015",
cssTarget: "chrome61",
rollupOptions: {
output: {
compact: true, // 开启紧凑模式,省略所有不必要的空格和注释
chunkFileNames: "js/[name]-[hash].js",
entryFileNames: "js/[name]-[hash].js",
assetFileNames: "[ext]/[name]-[hash].[ext]",
manualChunks: {
react: ["react", "react-dom", "react-router-dom", "zustand"],
antd: ["antd", "dayjs"],
},
},
build: {
// 默认 esbuild minify,而 esbuild 不仅会做压缩
// 而且还会在 target 配置允许的范围内做一些语法转换(例如把低版本语法转为高版本)
// 尽可能减小 bundle 体积。最关键的是,esbuild 的 target 默认 esnext,
// 这种情况下,即使你用 Babel、PostCSS 等工具做语法转换,也很难保证 esbuild 不会给你转换成高版本语法
// (因为代码压缩总是最后一步)。
// 由于 esbuild 最低只支持 es2015,如果需要支持更低版本浏览器,则可以改用 terser 压缩
// minify: "terser",
target: "es2015",
cssTarget: "chrome61",
rollupOptions: {
output: {
compact: true, // 开启紧凑模式,省略所有不必要的空格和注释
chunkFileNames: "js/[name]-[hash].js",
entryFileNames: "js/[name]-[hash].js",
assetFileNames: "[ext]/[name]-[hash].[ext]",
manualChunks: {
react: ["react", "react-dom", "react-router-dom", "zustand"],
antd: ["antd", "dayjs"],
},
},
},
};
},
});

0 comments on commit 20cc6c2

Please sign in to comment.