@weapp-stylex/uni-app

StyleX Vite plugin for uni-app Vue 3 targeting WeChat, Alipay, Douyin and H5
963 2
Install
npm install @weapp-stylex/uni-app
Latest Version:0.3.1
License:MIT
Last Updated:Oct 23, 2026
Links: GitHub  ·  npm
Maintainer: icebreaker

@weapp-stylex/uni-app

uni-app Vue 3 微信/支付宝/抖音小程序与 H5 的 StyleX Vite 适配器。提供 ESM 和 CommonJS 入口。

pnpm add @weapp-stylex/core
pnpm add -D @weapp-stylex/uni-app

在 uni() 后注册插件:

import uniImport from '@dcloudio/vite-plugin-uni'
import { stylexUniApp } from '@weapp-stylex/uni-app'
import { defineConfig } from 'vite'

const uni
  = (uniImport as unknown as { default?: typeof uniImport }).default ?? uniImport
export default defineConfig({ plugins: [uni(), ...stylexUniApp()] })

使用 uni build -p mp-weixin。Vue 通过 computed 和显式 :class / :style 绑定官方 attrs() 的结果;支持共享样式和直接导入 tokens.stylex.ts 的主题。

要求 Node.js ^22.22.1 || >=24.11.0。当前兼容 DCloud Vue 3 通道 3.0.0-alpha-5030120260930001,示例固定 Vite 5.2.8 / Vue 3.4.21。采用 DCloud 配套 SFC parser,数值保持 px,rpx 需显式字符串。

完整示例和支持边界见 weapp-stylex。

MIT License。

构建使用 tsdown,保留 ESM/CJS 与对应声明;DCloud 宿主和共享编译器保持 external。

Platforms

The adapter infers mp-weixin, mp-alipay, mp-toutiao or h5 from uni-app. Mini-programs emit matching platform style companions. H5 emits an external CSS asset with a content hash and an owned HTML stylesheet link. Numeric/px values keep official semantics; static rpx follows DCloud's H5 policy and dynamic values use browser units. Optional compiler target must match the active host.

Related Packages

@weapp-stylex/weapp-vite

StyleX compiler integration for native and Wevu mini-programs and the weapp-vite...

959 2
@weapp-stylex/taro

StyleX plugin for Taro React and Vue 3 targeting WeChat, Alipay, Douyin and H5 w...

1,026 2
weapp-stylex

StyleX runtime and build adapters for WeChat, Alipay, Douyin and H5: native, Wev...

905 2
@weapp-stylex/compiler

Shared StyleX compiler for WeChat, Alipay, Douyin and H5: JavaScript, TypeScript...

1,139 2
@uni_toolkit/vite-plugin-component-config

一个用于 UniApp 项目的 Vite 插件,用于处理 Vue 文件中的 `<component-config>` 标...

5,870 30

Version History

Version Released License
0.3.1 MIT
0.3.0 MIT
0.2.0 MIT
0.1.1 MIT
0.1.0 MIT
Pre-releases (1)
Version Released License
0.0.0-stage