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

3.6.24开始一直到最新的3.6.26我的库一直编译失败,看报错像是jsx不支持了? #15515

Open
zhipenglin opened this issue Apr 16, 2024 · 6 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@zhipenglin
Copy link

相关平台

微信小程序

复现仓库

https://github.com/kne-union/antd-taro.git
小程序基础库: 2.24.6
使用框架: React

复现步骤

目前项目代码是没有问题的,但是将package.json中有关taro的包版本改到3.6.24及其以上时就会报错

✖ Errors: 

ModuleParseError: Module parse failed: Unexpected token (3304:6)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| const BaseExample = ()=>{
|     return (
>       <Space direction={'vertical'} size={30}>
|         <Space direction={'vertical'}>
|           <View>基础用法</View>

→ Watching... [2024/4/16 10:16:11]

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "
[object Array]".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

Node.js v18.18.2
ERROR: "start:example" exited with 1.

项目启动方法: npm run init && npm run start

期望结果

编译通过

实际结果

编译报错

环境信息

👽 Taro v3.6.26


  Taro CLI 3.6.26 environment info:
    System:                                                                                         
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 18.18.2 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      @tarojs/cli: ^3.6.26 => 3.6.26
      @tarojs/helper: file:../node_modules/@tarojs/helper => 3.6.26
      @tarojs/mini-runner: ^3.6.26 => 3.6.26
      @tarojs/plugin-framework-react: file:../node_modules/@tarojs/plugin-framework-react => 3.6.26 
      @tarojs/plugin-platform-weapp: file:../node_modules/@tarojs/plugin-platform-weapp => 3.6.26   
      @tarojs/react: file:../node_modules/@tarojs/react => 3.6.26
      @tarojs/runtime: file:../node_modules/@tarojs/runtime => 3.6.26
      @tarojs/shared: file:../node_modules/@tarojs/shared => 3.6.26
      @tarojs/taro: file:../node_modules/@tarojs/taro => 3.6.26
      @tarojs/taro-loader: ^3.6.26 => 3.6.26
      @tarojs/webpack5-runner: ^3.6.26 => 3.6.26
      babel-preset-taro: ^3.6.26 => 3.6.26
      eslint-config-taro: ^3.6.26 => 3.6.26
      react: file:../node_modules/react => 18.2.0

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Apr 16, 2024
This was referenced Apr 20, 2024
@hcw2175
Copy link

hcw2175 commented Apr 22, 2024

+1

image

从 3.6.27 降回 3.6.22,恢复正常。

@levidcd
Copy link

levidcd commented May 6, 2024

+1, 现在锁定3.6.24了

@xiaof520
Copy link
Contributor

有解决办法吗

@hcw2175
Copy link

hcw2175 commented Jun 18, 2024

+1

image

从 3.6.27 降回 3.6.22,恢复正常。

再次升级到 3.6.32,发下问题依然存在。排查了一下原因发现:monorepo 架构,pnpm 管理,项目引用了某个 workspace 模块就会报错,移除依赖就正常了。

估计是 Taro 3.6.25 修改了某个配置导致编译失败,降回 3.6.24 编译正常

希望快点修复,不然想升级都升级不了。

@eiinu
Copy link
Contributor

eiinu commented Jun 18, 2024

可参考
jdf2e/nutui#3091

@hcw2175
Copy link

hcw2175 commented Jun 19, 2024

可参考 jdf2e/nutui#3091

分别在 mini、h5 节点中加了 complie.include 配置就可以了!为啥这样搞啊?

...
mini: {
      // 解决 Taro 3.6.25 以上版本编译不通过问题
      compile: {
        include: [
          path.resolve(__dirname, '../shared')
        ]
      }
}
h5: {
      // 解决 Taro 3.6.25 以上版本编译不通过问题
      compile: {
        include: [
          path.resolve(__dirname, '../shared')
        ]
      },
}
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

No branches or pull requests

5 participants