$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
步骤中通过运行您的应用来分析您的应用。在此过程中,building
为true
。这在预渲染期间也适用。
const building: boolean;
开发
开发服务器是否正在运行。这不能保证与NODE_ENV
或MODE
对应。
const dev: boolean;
版本
config.kit.version.name
的值。
const version: string;
上一页 下一页