Skip to main content

$app/environment

import { const browser: boolean

true if the app is running in the browser.

browser
, const building: boolean

SvelteKit analyses your app during the build step by running it. During this process, building is true. This also applies during prerendering.

building
, const dev: boolean

Whether the dev server is running. This is not guaranteed to correspond to NODE_ENV or MODE.

dev
, const version: string

The value of config.kit.version.name.

version
} from '$app/environment';

browser

如果应用程序在浏览器中运行,则为 true

const browser: boolean;

building

SvelteKit 在 build 步骤中通过运行来分析您的应用程序。在此过程中,buildingtrue。这也适用于预渲染过程。

const building: boolean;

dev

表示开发服务端是否正在运行。这不能保证与 NODE_ENVMODE 对应。

const dev: boolean;

version

config.kit.version.name 的值。

const version: string;

在 GitHub 编辑此页面

上一页 下一页