Skip to content

Commit

Permalink
terser
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Dec 11, 2024
1 parent e3a562f commit b5beef8
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 20 deletions.
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.13.0",
"terser": "^5.37.0",
"typescript": "~5.7.2",
"vite": "^6.0.3"
}
Expand Down
58 changes: 53 additions & 5 deletions frontend/pnpm-lock.yaml

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

23 changes: 8 additions & 15 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';

// https://vite.dev/config/
export default defineConfig(({ mode }) => {
Expand All @@ -12,14 +11,7 @@ export default defineConfig(({ mode }) => {

return {
plugins: [
react(),
visualizer({
filename: 'dist/stats.html',
open: true,
gzipSize: true,
brotliSize: true,
template: 'treemap'
})
react()
],
server: {
port: parseInt(devPort),
Expand All @@ -37,13 +29,11 @@ export default defineConfig(({ mode }) => {
'process.env.BASE_URL': JSON.stringify(baseUrl),
},
build: {
target: 'esnext',
target: 'es2020',
minify: 'terser',
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
pure_getters: true,
passes: 3,
module: true,
toplevel: true,
Expand All @@ -64,8 +54,12 @@ export default defineConfig(({ mode }) => {
indent_level: 0
}
},
chunkSizeWarningLimit: 375,
reportCompressedSize: true,
chunkSizeWarningLimit: 400,
performance: {
maxEntrypointSize: 500000,
maxAssetSize: 500000
},
cssCodeSplit: true,
rollupOptions: {
output: {
Expand Down Expand Up @@ -178,7 +172,6 @@ export default defineConfig(({ mode }) => {
compact: true,
generatedCode: {
preset: 'es2015',
symbols: false,
constBindings: true
}
}
Expand All @@ -192,7 +185,7 @@ export default defineConfig(({ mode }) => {
legalComments: 'none',
ignoreAnnotations: true,
treeShaking: true,
target: 'esnext'
target: 'es2020'
}
};
});

0 comments on commit b5beef8

Please sign in to comment.