NervJS / taro-ui

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

taro next 引入 taro-ui 编译报错 #1065

Open tim0991 opened 4 years ago

tim0991 commented 4 years ago

引入 taro-ui的AtCheckbox组件报错

<template>
  <view class="todoapp section">123
  </view>
</template>

<script>
import { AtCheckbox } from 'taro-ui'
</script>

期望行为

报错信息

./node_modules/taro-ui/dist/weapp/index.ts Module not found: Can't resolve './style/index.scss' in '/www/mp/taro-next-todomvc/node_modules/taro-ui/dist/weapp'

系统信息

image taro-ui 2.3.4

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

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

欢迎提交 Issue~

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

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

Good luck and happy coding~

trlanfeng commented 4 years ago

同样遇到此问题,taro版本v3.0.0-rc.0,升级rc.0后与beta.6报错有改变。

[/Users/username/Code/dcs/test/node_modules/@tarojs/taromjs]
 @ ./node_modules/taro-ui/dist/weapp/components/input-number/index.tsx 11:0-32 185:33-37
 @ ./node_modules/taro-ui/dist/weapp/index.ts
 @ ./node_modules/taro-ui/dist/index.js
 @ ./src/components/ClockStep/index.tsx
 @ ./node_modules/babel-loader/lib!./src/pages/index/index.tsx
 @ ./src/pages/index/index.tsx,./node_modules/taro-ui/dist/weapp/components/loading/index.tsx
Module not found: Error: Can't resolve '@tarojs/taro' in '/Users/username/Code/dcs/test/node_modules/taro-ui/dist/weapp/components/loading'
resolve '@tarojs/taro' in '/Users/username/Code/dcs/test/node_modules/taro-ui/dist/weapp/components/loading'
  Parsed request is a module
  using description file: /Users/username/Code/dcs/test/node_modules/taro-ui/package.json (relative path: ./dist/weapp/components/loading)
    resolve as module
      /Users/username/Code/dcs/test/node_modules/taro-ui/dist/weapp/components/loading/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/test/node_modules/taro-ui/dist/weapp/components/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/test/node_modules/taro-ui/dist/weapp/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/test/node_modules/taro-ui/dist/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/test/node_modules/taro-ui/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/test/node_modules/node_modules doesn't exist or is not a directory
      /Users/username/Code/dcs/node_modules doesn't exist or is not a directory
      /Users/username/Code/node_modules doesn't exist or is not a directory
      /Users/username/node_modules doesn't exist or is not a directory
      /Users/node_modules doesn't exist or is not a directory
      /node_modules doesn't exist or is not a directory
      looking for modules in /Users/username/Code/dcs/test/node_modules
        using description file: /Users/username/Code/dcs/test/package.json (relative path: ./node_modules)
          using description file: /Users/username/Code/dcs/test/package.json (relative path: ./node_modules/@tarojs/taro)
            no extension
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro doesn't exist
            .js
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.js doesn't exist
            .jsx
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.jsx doesn't exist
            .ts
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.ts doesn't exist
            .tsx
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.tsx doesn't exist
            mjs
              /Users/username/Code/dcs/test/node_modules/@tarojs/taromjs doesn't exist
            as directory
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro doesn't exist
      looking for modules in /Users/username/Code/dcs/test/node_modules
        using description file: /Users/username/Code/dcs/test/package.json (relative path: ./node_modules)
          using description file: /Users/username/Code/dcs/test/package.json (relative path: ./node_modules/@tarojs/taro)
            no extension
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro doesn't exist
            .js
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.js doesn't exist
            .jsx
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.jsx doesn't exist
            .ts
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.ts doesn't exist
            .tsx
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro.tsx doesn't exist
            mjs
              /Users/username/Code/dcs/test/node_modules/@tarojs/taromjs doesn't exist
            as directory
              /Users/username/Code/dcs/test/node_modules/@tarojs/taro doesn't exist
normal-robot commented 4 years ago

试试使用 "taro-ui": "3.0.0-alpha.1",好像还没有正式版

puxiao commented 4 years ago

我也遇到了相同的错误,手工修改 xxx\node_modules\taro-ui\dist\weapp\index.ts, 把 ./ 改为 ../ 即可正常编译:

import '../style/index.scss' import '../style/themes/red.scss' import '../style/themes/purple.scss'


我说错了,虽然编译通过了,但是组件实际并不能用,在微信小程序调试工具里,什么都不显示,还报错误。

afeiship commented 3 years ago

taro@3 的对应安装ui3.0

npm i taro-ui@next