Commit 95e8c5ee by QuentinHsu Committed by GitHub

perf(web): optimize web Rsbuild and Tailwind build pipeline (#5786)

parent 52858ad1
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
"marked": "^4.1.1", "marked": "^4.1.1",
"mermaid": "^11.6.0", "mermaid": "^11.6.0",
"qrcode.react": "catalog:", "qrcode.react": "catalog:",
"react": "^19.2.6", "react": "catalog:",
"react-dom": "^19.2.6", "react-dom": "catalog:",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
"react-fireworks": "^1.0.4", "react-fireworks": "^1.0.4",
"react-i18next": "^13.0.0", "react-i18next": "^13.0.0",
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@rsbuild/core": "^2.0.7", "@rsbuild/core": "catalog:",
"@rsbuild/plugin-react": "^2.0.0", "@rsbuild/plugin-react": "catalog:",
"@so1ve/prettier-config": "^3.1.0", "@so1ve/prettier-config": "^3.1.0",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.21",
"eslint": "8.57.0", "eslint": "8.57.0",
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
"@hugeicons/react": "^1.1.6", "@hugeicons/react": "^1.1.6",
"@lezer/highlight": "^1.2.3", "@lezer/highlight": "^1.2.3",
"@lobehub/icons": "catalog:", "@lobehub/icons": "catalog:",
"@tailwindcss/postcss": "^4.3.0",
"@tanstack/react-query": "^5.100.14", "@tanstack/react-query": "^5.100.14",
"@tanstack/react-router": "^1.170.8", "@tanstack/react-router": "^1.170.8",
"@tanstack/react-table": "^8.21.3", "@tanstack/react-table": "^8.21.3",
...@@ -57,9 +56,9 @@ ...@@ -57,9 +56,9 @@
"nanoid": "^5.1.11", "nanoid": "^5.1.11",
"next-themes": "^0.4.6", "next-themes": "^0.4.6",
"qrcode.react": "catalog:", "qrcode.react": "catalog:",
"react": "^19.2.6", "react": "catalog:",
"react-day-picker": "^10.0.1", "react-day-picker": "^10.0.1",
"react-dom": "^19.2.6", "react-dom": "catalog:",
"react-hook-form": "^7.76.1", "react-hook-form": "^7.76.1",
"react-i18next": "^17.0.8", "react-i18next": "^17.0.8",
"react-icons": "catalog:", "react-icons": "catalog:",
...@@ -80,8 +79,9 @@ ...@@ -80,8 +79,9 @@
"zustand": "^5.0.13" "zustand": "^5.0.13"
}, },
"devDependencies": { "devDependencies": {
"@rsbuild/core": "^2.0.7", "@rsbuild/core": "catalog:",
"@rsbuild/plugin-react": "^2.0.0", "@rsbuild/plugin-react": "catalog:",
"@rsbuild/plugin-tailwindcss": "catalog:",
"@tanstack/react-query-devtools": "^5.100.14", "@tanstack/react-query-devtools": "^5.100.14",
"@tanstack/react-router-devtools": "^1.167.0", "@tanstack/react-router-devtools": "^1.167.0",
"@tanstack/router-plugin": "^1.168.11", "@tanstack/router-plugin": "^1.168.11",
......
export default {
plugins: {
'@tailwindcss/postcss': {},
},
}
...@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url' ...@@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url'
import { defineConfig, loadEnv } from '@rsbuild/core' import { defineConfig, loadEnv } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react' import { pluginReact } from '@rsbuild/plugin-react'
import { pluginTailwindcss } from '@rsbuild/plugin-tailwindcss'
import { tanstackRouter } from '@tanstack/router-plugin/rspack' import { tanstackRouter } from '@tanstack/router-plugin/rspack'
const __dirname = path.dirname(fileURLToPath(import.meta.url)) const __dirname = path.dirname(fileURLToPath(import.meta.url))
...@@ -23,7 +24,7 @@ export default defineConfig(({ envMode }) => { ...@@ -23,7 +24,7 @@ export default defineConfig(({ envMode }) => {
) as Record<string, { target: string; changeOrigin: boolean }> ) as Record<string, { target: string; changeOrigin: boolean }>
return { return {
plugins: [pluginReact()], plugins: [pluginReact(), pluginTailwindcss({ optimize: false })],
// Rsbuild 2: replaces deprecated `performance.chunkSplit` (RSPack 2 aligned) // Rsbuild 2: replaces deprecated `performance.chunkSplit` (RSPack 2 aligned)
splitChunks: { splitChunks: {
preset: 'default', preset: 'default',
...@@ -83,11 +84,7 @@ export default defineConfig(({ envMode }) => { ...@@ -83,11 +84,7 @@ export default defineConfig(({ envMode }) => {
performance: { performance: {
// Remove console in production // Remove console in production
removeConsole: isProd ? ['log'] : false, removeConsole: isProd ? ['log'] : false,
// Speed up repeated `rsbuild build` (local + CI when node_modules/.cache is preserved). buildCache: false,
// @see https://v2.rsbuild.dev/config/performance/build-cache
buildCache: {
cacheDigest: [process.env.VITE_REACT_APP_VERSION],
},
}, },
tools: { tools: {
rspack: { rspack: {
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
], ],
"catalog": { "catalog": {
"@lobehub/icons": "^5.10.0", "@lobehub/icons": "^5.10.0",
"@rsbuild/core": "^2.1.1",
"@rsbuild/plugin-react": "^2.1.0",
"@rsbuild/plugin-tailwindcss": "^2.0.3",
"axios": "^1.16.1", "axios": "^1.16.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"dayjs": "^1.11.20", "dayjs": "^1.11.20",
...@@ -14,6 +17,8 @@ ...@@ -14,6 +17,8 @@
"oxlint": "^1.69.0", "oxlint": "^1.69.0",
"prettier": "^3.8.3", "prettier": "^3.8.3",
"qrcode.react": "^4.2.0", "qrcode.react": "^4.2.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"react-icons": "^5.6.0", "react-icons": "^5.6.0",
"react-markdown": "^10.1.0", "react-markdown": "^10.1.0",
"remark-gfm": "^4.0.1", "remark-gfm": "^4.0.1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment