轉至主要內容

$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 上編輯此頁面

上一個 下一個