Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build:h5 -- --watch报错,小程序编译正常 #1356

Closed
iorange0411 opened this issue Dec 4, 2018 · 7 comments
Closed

npm run build:h5 -- --watch报错,小程序编译正常 #1356

iorange0411 opened this issue Dec 4, 2018 · 7 comments
Assignees

Comments

@iorange0411
Copy link

问题描述
执行npm run build:h5 -- --watch报错

复现步骤
[复现问题的步骤]
app.js加上
if (process.env.TARO_ENV === 'weapp') { require('taro-ui/dist/weapp/css/index.css') } else if (process.env.TARO_ENV === 'h5') { require('taro-ui/dist/h5/css/index.css') }
出现编译失败,报错
Module not found: Can't resolve 'taro-ui/dist/h5/css/index.css' in 'e:\xxx\xxx\.temp'
然后删除这段再编译
`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}>

|
| `

期望行为
H5编译正常

报错信息
Module not found: Can't resolve 'taro-ui/dist/h5/css/index.css' in 'e:\xxx\xxx\.temp'
`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}>

|
| `

系统信息

  • 操作系统: windows10
  • Taro 版本 v1.1.9
  • Node.js 版本v10.13.0
  • 报错平台 h5
@taro-bot
Copy link

taro-bot bot commented Dec 4, 2018

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@dragon1061
Copy link

我也是一样编译成H5报错,小程序正常,不知道是什么原因

@taro-bot
Copy link

taro-bot bot commented Dec 5, 2018

CC @Littly

@yuche yuche added the H5 label Dec 5, 2018
@taro-bot taro-bot bot assigned Littly Dec 5, 2018
@Littly
Copy link
Contributor

Littly commented Dec 5, 2018

检查一下taro-ui是不是v1.5.1? 如果是的话,降级到taro-ui@1.5.0
taro-ui@1.5.1打包方式发生了变化,后续会有文档说明

@tomee-oy
Copy link
Contributor

tomee-oy commented Dec 9, 2018

taro-ui降级的时候要注意“^”的使用:

   "taro-ui": "^1.4.0"    

上面这个配置表示安装2.0.0以下的最新版本。如果想要安装固定版本号的依赖,则要去掉前面的“^”:

  "taro-ui": "1.4.0"  

@taro-bot
Copy link

taro-bot bot commented Dec 17, 2018

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Dec 19, 2018
@taro-bot taro-bot bot closed this as completed Dec 19, 2018
@Jerrodly
Copy link

Jerrodly commented Jan 3, 2019

开发了一个项目,发现taro开发h5存在很大的局限性,比如:taro对h5和小程序的编译存在以下差异:

  • 内置组件的样式
  • 状态管理的函数event参数处理
  • 内置特性和函数不支持h5
  • 不支持类函数写法

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants