Skip to content

uni-helper/uni-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8e22721 · Apr 23, 2023

History

8 Commits
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 23, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023
Apr 14, 2023

Repository files navigation

@uni-helper/uni-env

在 uni-app 中优雅的判断当前环境

安装

# Using Yarn
yarn add @uni-helper/uni-env

# Using npm
npm i @uni-helper/uni-env

# Using pnpm
pnpm i @uni-helper/uni-env

使用

// ESM
import { isMpWeixin } from "@uni-helper/uni-env";

// CommonJS
const { isMp } = require("@uni-helper/uni-env");

你可以从 ./src/index.ts 中查看更多标志以及如何判断的。

注意

这个包更多的是为插件开发者提供,如果你在运行时引入并不能做到条件编译。

要做条件编译的话,请使用官方的 跨端兼容 - 条件编译,如果你需要更好的条件编译,你可以使用 vite-plugin-conditional-compiler

协议

MIT