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

taro-axios 经过 terser 压缩导致 post 请求失败 #7432

Closed
lastSeries opened this issue Aug 25, 2020 · 1 comment
Closed

taro-axios 经过 terser 压缩导致 post 请求失败 #7432

lastSeries opened this issue Aug 25, 2020 · 1 comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@lastSeries
Copy link

相关平台

微信小程序

复现仓库

https://codepen.io/lastSeries/pen/vYGxYRK
小程序基础库: 2.12.1
使用框架: React

复现步骤

npm run build:weapp

期望结果

1598316841291
k1=v1&k2=v2&k3=v3

实际结果

1598316983487

{"postData":{"k1":"v1","k2":"v2","k3":"v3"}}

环境信息

  Taro CLI 3.0.5 environment info:
    System:
      OS: macOS 10.15.6
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
    npmPackages:
      @tarojs/components: 3.0.5 => 3.0.5 
      @tarojs/mini-runner: 3.0.5 => 3.0.5 
      @tarojs/react: 3.0.5 => 3.0.5 
      @tarojs/runtime: 3.0.5 => 3.0.5 
      @tarojs/taro: 3.0.5 => 3.0.5 
      @tarojs/webpack-runner: 3.0.5 => 3.0.5 
      babel-preset-taro: 3.0.5 => 3.0.5 
      eslint-config-taro: 3.0.5 => 3.0.5 
      react: ^16.10.0 => 16.13.1 
    npmGlobalPackages:
      typescript: 3.5.2
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Aug 25, 2020
@Chen-jj Chen-jj added this to the 3.0.10 milestone Sep 3, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.10, 3.0.11 Sep 10, 2020
@ZakaryCode ZakaryCode modified the milestones: 3.0.11, 3.0.12 Sep 18, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.15, 3.0.16 Oct 23, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.16, 3.0.17 Nov 5, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.17, 3.0.18 Nov 17, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.18, 3.0.19 Dec 4, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.19, 3.0.20, 3.0.22 Dec 19, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.22, 3.1.0 Jan 4, 2021
@Chen-jj Chen-jj removed this from the 3.1.0 milestone Jan 27, 2021
@Chen-jj
Copy link
Contributor

Chen-jj commented Jan 27, 2021

@lastSeriestaro-axios 这个包依赖的 axios 的版本的问题。

axios 里使用 data.toString() === '[object PostData]' 去判断是否是一个 PostData 对象,但压缩后 PostData 类名被压缩了,导致判断失败:

image

image

可以升级 axios 版本再试试。

@Chen-jj Chen-jj closed this as completed Jan 27, 2021
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
None yet
Development

No branches or pull requests

3 participants