taro icon indicating copy to clipboard operation
taro copied to clipboard

从jest尝试切换到vitest出现 Failed to resolve import

Open Jinx-1120 opened this issue 11 months ago • 4 comments

相关平台

微信小程序

复现仓库

https://github.com/Jinx-1120/test-taro-vitest.git 小程序基础库: 3.0.0 使用框架: React

复现步骤

pnpm i

pnpm run test

期望结果

希望vitest能够正常运行

实际结果

Error: Failed to resolve import "@tarojs/components/dist/components" from "node_modules/@tarojs/components/lib/react/components.js". Does the file exist?

环境信息

👽 Taro v3.6.20


  Taro CLI 3.6.20 environment info:
    System:
      OS: macOS 14.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.18.0 - ~/Library/Caches/fnm_multishells/32937_1710754364518/bin/node
      Yarn: 4.0.2 - ~/Library/Caches/fnm_multishells/32937_1710754364518/bin/yarn
      npm: 9.8.1 - ~/Library/Caches/fnm_multishells/32937_1710754364518/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.20 => 3.6.20 
      @tarojs/components: 3.6.20 => 3.6.20 
      @tarojs/helper: 3.6.20 => 3.6.20 
      @tarojs/plugin-framework-react: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-alipay: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-h5: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-jd: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-qq: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-swan: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-tt: 3.6.20 => 3.6.20 
      @tarojs/plugin-platform-weapp: 3.6.20 => 3.6.20 
      @tarojs/react: 3.6.20 => 3.6.20 
      @tarojs/runtime: 3.6.20 => 3.6.20 
      @tarojs/shared: 3.6.20 => 3.6.20 
      @tarojs/taro: 3.6.20 => 3.6.20 
      @tarojs/taro-loader: 3.6.20 => 3.6.20 
      @tarojs/webpack5-runner: 3.6.20 => 3.6.20 
      babel-preset-taro: 3.6.20 => 3.6.20 
      eslint-config-taro: 3.6.20 => 3.6.20 
      react: ^18.0.0 => 18.2.0

Jinx-1120 avatar Mar 19 '24 10:03 Jinx-1120