$app/environment
import { const browser: booleantrue if the app is running in the browser.
browser, const building: booleanSvelteKit analyses your app during the build step by running it. During this process, building is true. This also applies during prerendering.
building, const dev: booleanWhether the dev server is running. This is not guaranteed to correspond to NODE_ENV or MODE.
dev, const version: stringThe value of config.kit.version.name.
version } from '$app/environment';瀏覽器
如果應用程式在瀏覽器中執行,則為 true。
const browser: boolean;建置
SvelteKit 會透過執行你的應用程式在 build 步驟中進行分析。在此過程中,building 為 true。這也套用於事前呈示。
const building: boolean;開發
開發伺服器是否正在執行。這並不保證與 NODE_ENV 或 MODE 相符。
const dev: boolean;版本
config.kit.version.name 的值。
const version: string;上一個 下一個