Skip to content

Commit

Permalink
perf(build): optimize bundle size by code splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoAria committed Oct 19, 2024
1 parent e23280b commit eed07ce
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"classnames": "^2.5.1",
"dayjs": "^1.11.13",
"framer-motion": "^11.11.9",
"highlight.js": "^11.10.0",
"html-react-parser": "^5.1.18",
"nanostores": "^0.11.3",
"node-polyglot": "^2.6.0",
Expand Down Expand Up @@ -58,7 +57,6 @@
"devDependencies": {
"@biomejs/biome": "1.9.3",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.2",
"depcheck": "^1.4.7",
"husky": "^9.1.6",
Expand Down
19 changes: 0 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/components/Article/CodeBlock.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
.language-selector,
.copy-button {
position: absolute;
top: 10px;
top: 3px;
z-index: 1;
}

.language-selector {
right: 52px;
width: 80px;
right: 38px;
width: 100px;
}

.copy-button {
right: 10px;
right: 3px;
}
11 changes: 6 additions & 5 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export default defineConfig({
plugins: [
react(),
VitePWA({ registerType: "autoUpdate" }),
// visualizer(),
// visualizer({
// gzipSize: true,
// }),
],
server: {
host: "0.0.0.0",
Expand All @@ -17,10 +19,9 @@ export default defineConfig({
outDir: "build",
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes("node_modules")) {
return "vendor";
}
manualChunks: {
"react-vendor": ["react", "react-dom"],
"arco-vendor": ["@arco-design/web-react"],
},
},
},
Expand Down

0 comments on commit eed07ce

Please sign in to comment.