跳至主要内容

$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';

浏览器

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

const browser: boolean;

构建

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

const building: boolean;

开发

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

const dev: boolean;

版本

config.kit.version.name的值。

const version: string;

在 GitHub 上编辑此页面

上一页 下一页