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

上传小程序报错:Error: 非法的文件,错误信息:invalid file: vendors.js, 2:317892, SyntaxError: Unexpected token ? #15520

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

Comments

@xian107
Copy link

xian107 commented Apr 16, 2024

相关平台

微信小程序

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

复现步骤

Error: 非法的文件,错误信息:invalid file: vendors.js, 2:317892, SyntaxError: Unexpected token ?(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[216],{2592:function(e,t,n){"use strict";n.d(t,{NY:function(){return X},S1:function(){return q}});var r={};function i(e){returnMinified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. }n.r(r),n.d(r,{__DO_NOT_USE__ActionTypes:function(){return c},applyMiddleware:function(){return y},bindActionCreators:function(){return g},combineReducers:function(){return h},compose:function(){return m},createStore:function(){return f},isAction:function(){return b},isPlainObject:function(){return s},legacy_createStore:function(){return d}});var a=(()=>"function"===typeof Symbol&&Symbol.observable||"@@observable")(),o=a,u=()=>Math.random().toString(36).substring(7).split("").join("."),l={INIT:@@redux/INIT${u()},REPLACE:@@redux/REPLACE${u()},PROBE_UNKNOWN_ACTION:()=>` 等等

期望结果

微信开发者工具打包后能够正常使用,但是上传却失败了,不知道哪里错了

实际结果

希望能上传成功

环境信息

Taro CLI 3.6.25 environment info:
    System:
      OS: macOS 13.3.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
      Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
      npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.25 => 3.6.25 
      @tarojs/components: 3.6.25 => 3.6.25 
      @tarojs/helper: 3.6.25 => 3.6.25 
      @tarojs/plugin-framework-react: 3.6.25 => 3.6.25 
      @tarojs/plugin-html: ^3.6.25 => 3.6.25 
      @tarojs/plugin-platform-alipay: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-h5: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-jd: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-qq: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-swan: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-tt: 3.6.25 => 3.6.25 
      @tarojs/plugin-platform-weapp: 3.6.25 => 3.6.25 
      @tarojs/react: 3.6.25 => 3.6.25 
      @tarojs/runtime: 3.6.25 => 3.6.25 
      @tarojs/shared: 3.6.25 => 3.6.25 
      @tarojs/taro: 3.6.25 => 3.6.25 
      @tarojs/taro-loader: 3.6.25 => 3.6.25 
      @tarojs/webpack5-runner: 3.6.25 => 3.6.25 
      babel-preset-taro: 3.6.25 => 3.6.25 
      eslint-config-taro: 3.6.25 => 3.6.25 
      react: ^18.0.0 => 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
@zenochan
Copy link

@xian107 遇到了同样的问题,我通过降级 redux 依赖解决了,原因是编译后的代码中含 ?? 操作符

- "react-redux": "^9.1.0",
- "redux": "^5.0.1",
+ "react-redux": "^8.1.2",
+ "redux": "^4.2.1",

@xian107
Copy link
Author

xian107 commented Apr 22, 2024

@zenochan

@xian107 遇到了同样的问题,我通过降级 redux 依赖解决了,原因是编译后的代码中含 ?? 操作符

- "react-redux": "^9.1.0",
- "redux": "^5.0.1",
+ "react-redux": "^8.1.2",
+ "redux": "^4.2.1",

你真是牛逼,试了一下可以了

@xian107 xian107 closed this as completed Apr 22, 2024
@it-weitao
Copy link

把开发者工具里面的 “将 JS 编译成 ES5” 勾上再预览就可以了
image

@zenochan
Copy link

把开发者工具里面的 “将 JS 编译成 ES5” 勾上再预览就可以了

勾 es5 体积会变大,会焦虑~

@crazyair
Copy link

下次再遇到其他包,还是一样,我都没装 redux 也报错了

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
Archived in project
Development

No branches or pull requests

4 participants