NervJS / taro-ui

一款基于 Taro 框架开发的多端 UI 组件库
https://taro-ui.taro.zone
MIT License
4.52k stars 756 forks source link

taro-ui 组件无法运行 #1250

Open xiexikang opened 3 years ago

xiexikang commented 3 years ago

问题描述 我的taro版本是3.0.17,taro-ui是2.3.4 ,换了^3.0.0-alpha.3也还是无法正常运行 ,

复现步骤

  1. taro build --type h5 "--watch"

config/index.js h5: { esnextModules: ['taro-ui'] }

app.js

import 'taro-ui/dist/style/index.scss' import { AtButton } from 'taro-ui' console.log(AtButton) (加这些就报错,去除就没事, 那应该是taro版本和taro-ui的问题)

{
  "name": "myApp",
  "version": "1.0.0",
  "private": true,
  "description": "xxk",
  "templateInfo": {
    "name": "default",
    "typescript": false,
    "css": "sass"
  },
  "scripts": {
    "build:weapp": "taro build --type weapp",
    "build:swan": "taro build --type swan",
    "build:alipay": "taro build --type alipay",
    "build:tt": "taro build --type tt",
    "build:h5": "taro build --type h5",
    "build:rn": "taro build --type rn",
    "build:qq": "taro build --type qq",
    "build:jd": "taro build --type jd",
    "build:quickapp": "taro build --type quickapp",
    "dev:weapp": "npm run build:weapp -- --watch",
    "dev:swan": "npm run build:swan -- --watch",
    "dev:alipay": "npm run build:alipay -- --watch",
    "dev:tt": "npm run build:tt -- --watch",
    "dev:h5": "npm run build:h5 -- --watch",
    "dev:rn": "npm run build:rn -- --watch",
    "dev:qq": "npm run build:qq -- --watch",
    "dev:jd": "npm run build:jd -- --watch",
    "dev:quickapp": "npm run build:quickapp -- --watch"
  },
  "browserslist": [
    "last 3 versions",
    "Android >= 4.1",
    "ios >= 8"
  ],
  "author": "",
  "dependencies": {
    "@babel/runtime": "^7.7.7",
    "@tarojs/components": "3.0.17",
    "@tarojs/runtime": "3.0.17",
    "@tarojs/taro": "3.0.17",
    "taro-ui": "^3.0.0-alpha.3",
    "vue": "^3.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.0",
    "@tarojs/mini-runner": "3.0.17",
    "@tarojs/webpack-runner": "3.0.17",
    "@types/webpack-env": "^1.13.6",
    "@vue/compiler-sfc": "^3.0.0",
    "babel-preset-taro": "3.0.17",
    "eslint": "^6.8.0",
    "eslint-config-taro": "3.0.17",
    "eslint-plugin-vue": "^7.0.0",
    "stylelint": "9.3.0",
    "vue-loader": "^16.0.0-beta.8"
  }
}

报错信息 Failed to compile. ./node_modules/taro-ui/dist/index.umd.js Module not found: Can't resolve 'react' in 'D:\www-xxk\my-taro\myApp\node_modules\taro-ui\dist'

系统信息

有没有大佬知道怎么回事呐?感谢

taro-ui-bot[bot] commented 3 years ago

欢迎提交 Issue~

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

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

Good luck and happy coding~

zhangzhonghe commented 3 years ago

052A0CF0-40AE-4602-AACF-14B223407EE5

这几个依赖安装下试试。

zhangzhonghe commented 3 years ago

@xiexikang vue 的话试一下这个 http://taro-ui-vue.fontend.com/#/docs/introduction