Skip to main content

$app/manifest

import { assets, immutable, prerendered, routes } from '$app/manifest';

This module is available to service workers and other contexts. It exports information about the build output, static files, prerendered pages, and routes.

assets

An array of { path: AssetPath } objects representing the files in your static directory, or whatever directory is specified by config.files.assets. The path is relative to the base path, and can be used with asset(...).

const assets: Array<{
	path: import('$app/types').AssetPath;
}>;

immutable

An array of { path: string } objects representing the files generated by Vite. The path is relative to the base path, and is intended for use with cache.add(...) inside a service worker. During development, this is an empty array.

const immutable: Array<{ path: string }>;

prerendered

An array of { path: Path } objects representing prerendered pages and endpoints, relative to the base path. During development, this is an empty array.

const prerendered: Array<{
	path: import('$app/types').Path;
}>;

routes

An array of objects representing the routes in your app. Only routes that the router can match are included — directories that merely hold a +layout are not routes of their own.

Each object has an id, plus page and endpoint booleans describing whether the route has a +page and/or a +server. Both are true for a route that has both, so the capabilities can be filtered independently:

import { routes } from '$app/manifest';

const pages = routes.filter((route) => route.page);
const endpoints = routes.filter((route) => route.endpoint);
const routes: ManifestRoute[];

ManifestRoute

A route in your app, along with its capabilities. page indicates the presence of a +page, while endpoint indicates the presence of a +server. Both are true when both files exist.

type ManifestRoute =
	| {
			id: Exclude<
				import('$app/types').PageRouteId,
				import('$app/types').EndpointRouteId
			>;
			page: true;
			endpoint: false;
	  }
	| {
			id: Exclude<
				import('$app/types').EndpointRouteId,
				import('$app/types').PageRouteId
			>;
			page: false;
			endpoint: true;
	  }
	| {
			id: Extract<
				import('$app/types').PageRouteId,
				import('$app/types').EndpointRouteId
			>;
			page: true;
			endpoint: true;
	  };

Edit this page on GitHub llms.txt