Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.

Follow publication

Member-only story

Vue3 Performance Optimization — Bundle Optimization

Shawn Kang
Stackademic
Published in
7 min readJun 21, 2024

--

Through its data two-way binding and virtual DOM technologies, the Vue framework takes care of the most tedious and dirtiest part of front-end development — DOM manipulations. We no longer need to concern ourselves with how to manipulate the DOM or how to do it most efficiently. However, issues like first-screen optimization and compilation configuration optimization still exist in Vue projects. Therefore, we still need to focus on performance optimization for Vue projects to achieve more efficient performance and a better user experience.

Vue3 Performance Optimization — Code-Level Optimization

Gzip Compression

When front-end resources are too large, server resource requests can be slow. The front-end can reduce the file size by approximately 60% through Gzip compression. The compressed files, after simple processing by the backend, can be normally decoded by browsers.

Install Plugin

yarn add vite-plugin-compression -D

Vite Configuration

// vite.config.ts
import viteCompression from 'vite-plugin-compression';

export default defineConfig({
plugins: [
// ....
viteCompression({
algorithm: 'gzip',
deleteOriginFile: false, // Whether…

--

--

Published in Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.

Written by Shawn Kang

Focusing on front-end development and internet writing. Sharing technical tutorials and original fiction. https://skstory.online/

Responses (1)

Write a response