tezvyn:

Vue, Angular & Svelte

Vue 3, Nuxt, Angular, Svelte, SvelteKit

307 bites

More in Vue, Angular & Svelte — page 10

Vue, Angular & Svelte2 min read

ISR: Static Speed for Dynamic Content

Incremental Static Regeneration (ISR) gives users a fast, static page while regenerating it in the background. It's ideal for e-commerce catalogs or blogs that update periodically.

SvelteKit Server-Only Modules: Keep Your Secrets Secret
Vue, Angular & Svelte2 min read

SvelteKit Server-Only Modules: Keep Your Secrets Secret

SvelteKit's server-only modules are a firewall for your code, preventing sensitive data like API keys from ever being bundled for the browser. Use them for database clients or secret logic.

SvelteKit Prerendering: Build-Time HTML for Faster Sites
Vue, Angular & Svelte2 min read

SvelteKit Prerendering: Build-Time HTML for Faster Sites

SvelteKit prerendering creates static HTML files at build time for instant loads. It's ideal for content that doesn't change per user, like marketing pages or blog posts. The main footgun: unlinked pages won't be found unless you explicitly list them.

Angular: Run Code Only on Browser or Server
Vue, Angular & Svelte2 min read

Angular: Run Code Only on Browser or Server

Angular Universal runs your app twice: on a server and in a browser. Use `isPlatformBrowser` to run code only where it's safe, like accessing `window` or `document`, to prevent your server-side render from crashing.

Angular TransferState: Avoid Double Data Fetching in SSR
Vue, Angular & Svelte2 min read

Angular TransferState: Avoid Double Data Fetching in SSR

TransferState is a key-value cache that bridges your Angular SSR server and the browser, preventing the client from re-fetching data the server already got. Use it to pass resolved API data from the server render to the client, avoiding wasted network calls.

Vue, Angular & Svelte2 min read

Nuxt Server Data Fetching: useAsyncData & useFetch

Avoid client-side request waterfalls by fetching data on the server and embedding it in the page. Nuxt's `useAsyncData` and `useFetch` handle this SSR hydration for you. The main footgun: not providing a stable key, leading to re-fetches.

Universal Rendering: Server-First, Client-Interactive
Vue, Angular & Svelte2 min read

Universal Rendering: Server-First, Client-Interactive

Universal Rendering sends a pre-built HTML page from the server for a fast load, then adds interactivity on the client. It's the default in frameworks like Nuxt for better SEO, but the footgun is writing code that crashes on the server by assuming a browser.

Vue, Angular & Svelte2 min read

Static Site Generation: Pre-built Pages for Speed & Simplicity

Static Site Generation (SSG) pre-builds every page of your site into static HTML files, instead of generating them on-demand. This makes sites incredibly fast and cheap to host on a CDN, perfect for blogs or docs. The footgun: build times grow with site size.

Vue, Angular & Svelte2 min read

Server-Side Rendering: Your App's First Paint Matters

Server-Side Rendering (SSR) sends a fully-formed HTML page from the server, not a blank one. This speeds up the first paint and helps SEO. The footgun is assuming it's always faster; it increases server load and can delay interactivity.

Angular Incremental Compilation: Faster Rebuilds
Vue, Angular & Svelte2 min read

Angular Incremental Compilation: Faster Rebuilds

Angular's incremental compilation avoids full rebuilds by tracking changes, making performance proportional to what you changed, not the whole app. It speeds up development by reusing analysis and skipping file generation for unchanged code.

Framework Reactivity: Coarse vs. Fine-Grained Updates
Vue, Angular & Svelte2 min read

Framework Reactivity: Coarse vs. Fine-Grained Updates

Frameworks sync UI and state differently. Coarse-grained systems like React re-run component code, while fine-grained systems like Vue (Proxies) or Angular (Signals) track dependencies to update only what's needed.

Vue, Angular & Svelte2 min read

Vue's <script setup>: Less Boilerplate, More Performance

Vue's <script setup> is compile-time sugar that automatically exposes variables and functions to your template, cutting boilerplate. It yields more succinct, performant components with better type-safety.

Configuring the Angular Compiler (ngc)
Vue, Angular & Svelte2 min read

Configuring the Angular Compiler (ngc)

The Angular Compiler (ngc) transforms your templates into optimized JavaScript ahead-of-time. You tune it in `tsconfig.json` to create smaller production builds or publish reusable libraries.

Angular Ivy: The Tree-Shakable Compiler
Vue, Angular & Svelte2 min read

Angular Ivy: The Tree-Shakable Compiler

Angular's Ivy engine compiles components like separate puzzle pieces, making apps smaller and faster. This enables effective tree-shaking for smaller bundles and faster rebuilds.

Vue, Angular & Svelte2 min read

Vue Single-File Components (SFCs)

Vue's Single-File Components (SFCs) bundle a component's template, logic, and styles into one `.vue` file. A build tool compiles this into browser-readable JS and CSS, turning your template into optimized render functions.

Vue, Angular & Svelte2 min read

Vue's Virtual DOM: Efficient UI Updates

Vue keeps a JavaScript copy of the UI (the Virtual DOM) in memory. When data changes, it compares a new virtual tree to the old one and efficiently updates only the changed parts of the real DOM, avoiding costly full re-renders.

Vue, Angular & Svelte2 min read

Playwright: E2E Tests That Aren't Flaky

Playwright makes E2E tests reliable by automatically waiting for UI elements to be ready. Use it to test critical user journeys across Chrome, Firefox, and WebKit. The footgun is using brittle CSS selectors instead of user-facing locators like `getByRole`.

Angular's TestBed: A Sandbox for Component Testing
Vue, Angular & Svelte2 min read

Angular's TestBed: A Sandbox for Component Testing

Angular's TestBed creates a mini-app just for your test, letting you check how a component renders and behaves with mock dependencies. It's for testing component-template interactions in isolation.

Vitest Mocking: Isolating Code with `vi.mock`
Vue, Angular & Svelte2 min read

Vitest Mocking: Isolating Code with `vi.mock`

Vitest's `vi.mock` replaces a module with a fake version, isolating your code for tests. This is key for preventing real network or database calls. The footgun: calls are "hoisted" to the top of the file, running before other code and breaking variable access.

Vue, Angular & Svelte2 min read

Svelte Testing Library: Test Components Like a User

Test Svelte components like a user would use them. Svelte Testing Library interacts with the rendered DOM, not internal state, to verify behavior. This avoids brittle tests tied to implementation.