Skip to content

使用v4.0.4脚手架安装 react vite 版本 编译微信小程序报错 #16226

Open
@DankeBIBI

Description

@DankeBIBI

相关平台

微信小程序

小程序基础库: 3.5.1
使用框架: React

复现步骤

正常使用taro 命令创建项目,然后 dev:weapp

首先缺少
✓ 1 modules transformed.
[babel] [BABEL] D:\project\react-test\D:\project\react-test\src\app.ts?entry-loader=true: Cannot find module '@babel/preset-react'

然后缺少
✓ 1 modules transformed.
[babel] [BABEL] D:\project\react-test\D:\project\react-test\src\app.ts?entry-loader=true: Cannot find module '@babel/plugin-proposal-class-properties'

然后安装依赖完毕后 run dev:weapp

微信开发工具控制台报

app.js错误:
TypeError: taro.getDefaultExportFromCjs is not a function

期望结果

正常运行

实际结果

报错

环境信息

👽 Taro v4.0.4


  Taro CLI 4.0.4 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 18.20.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.22 - C:\Program Files\nodejs\yarn.CMD
      npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: 4.0.4 => 4.0.4
      @tarojs/components: 4.0.4 => 4.0.4
      @tarojs/helper: 4.0.4 => 4.0.4
      @tarojs/plugin-framework-react: 4.0.4 => 4.0.4
      @tarojs/plugin-html: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-alipay: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-h5: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-jd: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-qq: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-swan: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-tt: 4.0.4 => 4.0.4
      @tarojs/plugin-platform-weapp: 4.0.4 => 4.0.4
      @tarojs/react: 4.0.4 => 4.0.4
      @tarojs/runtime: 4.0.4 => 4.0.4
      @tarojs/shared: 4.0.4 => 4.0.4
      @tarojs/taro: 4.0.4 => 4.0.4
      @tarojs/vite-runner: 4.0.4 => 4.0.4
      babel-preset-taro: 4.0.4 => 4.0.4
      eslint-config-taro: 4.0.4 => 4.0.4
      react: ^18.0.0 => 18.3.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactT-weappTarget - 编译到微信小程序V-3Version - 3.x

    Type

    No type

    Projects

    • Status

      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions