跳到主要內容

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

上一個 下一個