Home / Function/ loadSharp() — astro Function Reference

loadSharp() — astro Function Reference

Architecture documentation for the loadSharp() function in sharp.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  5df770ae_ba54_ac95_82f9_d5dd045489ae["loadSharp()"]
  e98aa86d_990d_0999_8b69_e22d93343858["sharp.ts"]
  5df770ae_ba54_ac95_82f9_d5dd045489ae -->|defined in| e98aa86d_990d_0999_8b69_e22d93343858
  65162a20_def3_0daf_b4e0_c43d00330756["sharpService.transform()"]
  65162a20_def3_0daf_b4e0_c43d00330756 -->|calls| 5df770ae_ba54_ac95_82f9_d5dd045489ae
  style 5df770ae_ba54_ac95_82f9_d5dd045489ae fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/assets/services/sharp.ts lines 32–44

async function loadSharp() {
	let sharpImport: typeof import('sharp');
	try {
		sharpImport = (await import('sharp')).default;
	} catch {
		throw new AstroError(AstroErrorData.MissingSharp);
	}

	// Disable the `sharp` `libvips` cache as it errors when the file is too small and operations are happening too fast (runs into a race condition) https://github.com/lovell/sharp/issues/3935#issuecomment-1881866341
	sharpImport.cache(false);

	return sharpImport;
}

Domain

Subdomains

Frequently Asked Questions

What does loadSharp() do?
loadSharp() is a function in the astro codebase, defined in packages/astro/src/assets/services/sharp.ts.
Where is loadSharp() defined?
loadSharp() is defined in packages/astro/src/assets/services/sharp.ts at line 32.
What calls loadSharp()?
loadSharp() is called by 1 function(s): sharpService.transform.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free