$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';browser
如果应用在浏览器中运行,则为 true。
¥true if the app is running in the browser.
const browser: boolean;building
SvelteKit 在 build 步骤中通过运行应用来分析你的应用。在此过程中,building 是 true。这也适用于预渲染期间。
¥SvelteKit analyses your app during the build step by running it. During this process, building is true. This also applies during prerendering.
const building: boolean;dev
开发服务器是否正在运行。这不能保证与 NODE_ENV 或 MODE 相对应。
¥Whether the dev server is running. This is not guaranteed to correspond to NODE_ENV or MODE.
const dev: boolean;version
config.kit.version.name 的值。
¥The value of config.kit.version.name.
const version: string;