NervJS / taro

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。 https://taro.zone/
https://docs.taro.zone/
Other
35.57k stars 4.79k forks source link

h5运行环境下,采用taro3.5.4 webpack5打包,webpack-runner5中resolve-url-loader版本为4,里面postcss还是7.x导致不匹配报错 #12388

Open tan2009216028 opened 2 years ago

tan2009216028 commented 2 years ago

相关平台

H5

复现仓库

https://github.com/HowToLiveLonger.git 浏览器版本: chrome 使用框架: React

复现步骤

场景:h5运行环境下,采用taro3.5.4 webpack5打包,其中scss引入@import '~normalize.css',采用~引入方式

现象:报错提示postcss版本不一致

原因:webpack-runner5中resolve-url-loader版本为4,里面postcss还是7.x导致不匹配报错,建议resolve-url-loader升级最新5版本

提示:仓库地址不存在的,不要看,问题简单明了,无需demo

期望结果

采用类似@import '~normalize.css'的~引入方式能够正确编译

实际结果

报错提示不通过

环境信息

本地业务工程taro-cli 3.5.4

  Taro CLI 3.5.4 environment info:
    System:
      OS: macOS 11.6
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
      Yarn: 1.22.11 - /usr/local/bin/yarn
      npm: 7.22.0 - ~/.nvm/versions/node/v14.17.6/bin/npm
    npmPackages:
      @tarojs/cli: ^3.5.4 => 3.5.4 
      @tarojs/components: 3.5.4 => 3.5.4 
      @tarojs/helper: 3.5.4 => 3.5.4 
      @tarojs/plugin-framework-react: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-alipay: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-jd: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-qq: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-swan: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-tt: 3.5.4 => 3.5.4 
      @tarojs/plugin-platform-weapp: 3.5.4 => 3.5.4 
      @tarojs/react: 3.5.4 => 3.5.4 
      @tarojs/router: 3.5.4 => 3.5.4 
      @tarojs/runtime: 3.5.4 => 3.5.4 
      @tarojs/shared: 3.5.4 => 3.5.4 
      @tarojs/taro: 3.5.4 => 3.5.4 
      @tarojs/taro-h5: 3.5.4 => 3.5.4 
      @tarojs/taro-loader: 3.5.4 => 3.5.4 
      babel-preset-taro: 3.5.4 => 3.5.4 
      eslint-config-taro: 3.5.4 => 3.5.4 
      react: ^18.2.0 => 18.2.0 
kaifa-yang commented 2 years ago

解惑了吗,帮我看看https://github.com/NervJS/taro/issues/12432#issue-1360897215