0.1.0-alpha.2 • Published 1 year ago

tarojs-plugin-h5-native-components v0.1.0-alpha.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

背景

因为Taro不支持把组件编译为原生h5组件,此插件读取app.config.js中components的配置,通通打包成h5组件,方便h5应用使用。

支持版本 taro3.6.6

如何使用

  1. 本包不包含@trao/components,所以React项目自行安装
  2. 安装依赖
npm install tarojs-plugin-h5-native-components -D
  1. 启用插件,修改taro配置
{
  "plugins": [
    "tarojs-plugin-h5-native-components"
  ]
}
  1. package.json添加命令
{
  "script": {
    "build:h5-native-comps": "taro build --type h5-native-component" 
  }
}
  1. 执行命令
npm run build:h5-native-comps

如果app.config.js中components是有配置的,那么正常会在dist目录下也会生成components文件夹,直接复制到react即可。 6. 在项目入口文件添加如下代码

import { defineCustomElements } from '@tarojs/components/loader'
defineCustomElements();
0.1.0-alpha.1

1 year ago

0.1.0-alpha.2

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago