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

编译出现 @tarojs/taro/html.css 找不到 taro 版本>=3.4.0 都有该问题,3.3.18没有问题 #11415

Closed
soeasyjx opened this issue Mar 8, 2022 · 3 comments
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@soeasyjx
Copy link

soeasyjx commented Mar 8, 2022

相关平台

H5

浏览器版本: Chrome 99.0.4844.51(正式版本) (x86_64)
使用框架: React

复现步骤

安装依赖 cnpm i
运行命令 npm run dev:h5

期望结果

编译正常

实际结果

Failed to compile.

./src/pages/index/index.jsx
Module not found: Can't resolve '@tarojs/taro/html.css' in '/Users/jiangxin/test_project/taro/taro_demo1/src/pages/index'

环境信息

Taro v3.4.0


  Taro CLI 3.4.0 environment info:
    System:
      OS: macOS 12.2.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
      Yarn: 1.22.11 - ~/.nvm/versions/node/v14.16.1/bin/yarn
      npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
    npmPackages:
      @tarojs/cli: 3.4.0 => 3.4.0 
      @tarojs/components: 3.4.0 => 3.4.0 
      @tarojs/mini-runner: 3.4.0 => 3.4.0 
      @tarojs/react: 3.4.0 => 3.4.0 
      @tarojs/runtime: 3.4.0 => 3.4.0 
      @tarojs/taro: 3.4.0 => 3.4.0 
      @tarojs/webpack-runner: 3.4.0 => 3.4.0 
      babel-preset-taro: 3.4.0 => 3.4.0 
      eslint-config-taro: 3.4.0 => 3.4.0 
      react: ^17.0.2 => 17.0.2 
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.10 
    npmGlobalPackages:
      typescript: 4.2.4
@taro-bot2 taro-bot2 bot added F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x labels Mar 8, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2022

等待热心的小伙伴解决问题中..., 有一些相关的 issues 可能帮助到你!

Thank you so much!

@soeasyjx soeasyjx changed the title 编译出现 @tarojs/taro/html.css 找不到 taro 版本>=3.4.0 都有问题,3.3.18没有问题 编译出现 @tarojs/taro/html.css 找不到 taro 版本>=3.4.0 都有该问题,3.3.18没有问题 Mar 8, 2022
@Chen-jj
Copy link
Contributor

Chen-jj commented Mar 12, 2022

duplicate #11390

@Chen-jj Chen-jj closed this as completed Mar 12, 2022
@Chen-jj
Copy link
Contributor

Chen-jj commented Mar 12, 2022

@soeasyjx 使用 require 代替 import 引入咯,在 H5 不需要这个样式文件。

if (process.env.TARO_ENV !== 'h5') {
  require('@tarojs/taro/html.css')
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
Development

No branches or pull requests

2 participants