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

You may need an appropriate loader to handle this file type.

npm run dev:h5 命令报错了; 

You may need an appropriate loader to handle this file type. 

不知什么情况?是不是什么配置不对,还是安装出错了。

正在回答

1 回答

H5 模式下编译报错?

如果出现类似 You may need an appropriate loader to handle this file type 的问题,如下:

./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">

请在 config/index.js 文件中添加如下配置项:

h5: {
 esnextModules: ['taro-ui']
}

另外:

// app.js
import 'taro-ui/dist/style/index.scss' // 全局引入一次即可

希望能帮到你!

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

举报

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

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

进入课程

You may need an appropriate loader to handle this file type.

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