常见问题
第三方包next没有转换meet-react
1. 默认组件替换会exclude node_modules目录,如果某些包,需要做组件替换,可以进行如下配置
具体配置说明请参考 ice配置文档: compileDependencies
build.json增加如下配置
{
...
"compileDependencies": ["@alife/oc-scene", "xxx"],// @alife/oc-scene包会进行组件替换
...
}
2. 除了上面这种方式外,也可以通过配置自定义映射
build.json增加如下配置
{
...
"cone": {
"oneCode": true,
"pcToMobile": {
"@alife/oc-scene": "@alife/oc-scene/mobile"
}
}
...
}
3. 没有引入按需加载插件
一码多端替换只会 将@alifd/next/lib(es)/xxx 转换成 @alifd/meet-react/lib(es)/xxx。如果项目没有使用按需加载,组件不会做转换, 有两种方式可以解
-
所有引入使用按需方式
import Button from '@alifd/next/lib/button'; import '@alifd/next/lib/button/style';
- 引入import插件
- 项目根目录增加 .babelrc 文件, 内容如下
// .babelrc 配置
{
"plugins": [
[
"babel-plugin-import",
{
"libraryName": "@alifd/next",
"style": true
}
]
]
}
无线主题样式没有生效 或者 大小扩大一倍
无线主题导出有两个版本,一个的dist/index.css (rpx单位), 另一个是dist/index.web.css(vw单位)。如果你引入的是rpx单位,则无线主题会失效。参考: https://design.sto.cn/h5/MvYCjjzP6OPqJMBV
目前无线主题导出都是已750px规范来转换的,默认size会大一倍。目前有两种方式设置:
- 将rpx单位的主题导出,重新封包转换成rem单位。 参考 http://gitlab.sto.cn/cone/sto-theme-mobile-rem
- 可以通过导出模板进行转换配置 (目前只有内网可以使用,外网目前使用不了)
发布模板请使用 @alife/meet-rem-theme-template@1.0.0 fusion主题的cdn地址: https://unpkg.alibaba-inc.com/{packageName}@{version}/index.css