为了账号安全,请及时绑定邮箱和手机立即绑定

引用taro-ui时报错

只有在父中引用<Foof/>时,编译就会报错如下。文档要求加的H5配置也加了。


Failed to compile.

./node_modules/_taro-ui@1.5.4@taro-ui/dist/h5/components/pagination/index.js 101:11 Module parse failed: Unexpected token (101:11) You may need an appropriate loader to handle this file type. |     }; | >     return <View className={classNames(rootClassName, classObject, this.props.className)} style={customStyle}> |         <View className="at-pagination__operate"> |           <View className="at-pagination__btns">


https://img1.sycdn.imooc.com//5c4680130001d8c405690561.jpg

正在回答

4 回答

请问楼主怎么解决的,我也是这样的错误,百度了很多,都是说修改h5配置,但是并没有卵用

0 回复 有任何疑惑可以回复我~
#1

qq_MR_2

升级到 Taro v1.2.26 "taro-ui": "^2.1.0" 注意修改两个地方: 1、config/index.js 的h5:配置添加 esnextModules: ['taro-ui'], 2、src/app.js 文件 import 'taro-ui/dist/h5/css/index.css'替换成 import 'taro-ui/dist/style/index.scss'
2019-05-07 回复 有任何疑惑可以回复我~
#2

慕运维8491645

加了配置之后重新编译一下 必须重新编译
2019-05-11 回复 有任何疑惑可以回复我~

D:/node_modules/_taro-ui@2.0.2@taro-ui/dist/h5/index.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):

ReferenceError: Unknown plugin "transform-object-rest-spread" specified in "base" at 5, attempted to resolve relative to "D:\\node_modules\\_taro-ui@2.0.2@taro-ui\\dist\\h5"

    at Array.map (<anonymous>)

配置完之后还是有这样的错误

0 回复 有任何疑惑可以回复我~
#1

qq_MR_2

升级到 Taro v1.2.26 "taro-ui": "^2.1.0" 注意修改两个地方: 1、config/index.js 的h5:配置添加 esnextModules: ['taro-ui'], 2、src/app.js 文件 import 'taro-ui/dist/h5/css/index.css'替换成 import 'taro-ui/dist/style/index.scss'
2019-05-07 回复 有任何疑惑可以回复我~

从1.5.2已经修复不是已经修复了吗?

0 回复 有任何疑惑可以回复我~
#1

水若寒宇

参考地址 https://nervjs.github.io/taro/docs/config-detail.html#h5esnextmodules
2019-01-22 回复 有任何疑惑可以回复我~
#2

街长 提问者

已经解决 谢谢
2019-01-22 回复 有任何疑惑可以回复我~
#3

jsbin 回复 街长 提问者

麻烦问下是怎么解决的
2020-01-16 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Taro多端框架开发外卖首页
  • 参与学习       22910    人
  • 解答问题       82    个

Taro 一套代码多端运行的框架,带你掌握Taro开发基本语法,以及项目开发

进入课程

引用taro-ui时报错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信