Coder Social home page Coder Social logo

Comments (9)

kingchen2008 avatar kingchen2008 commented on June 11, 2024 1

用socket.io-client 4.6.1打包,在微信小程序中使用,出现eval之类的错误。查看了socket.io-client源代码,没有发现有用eval之类的代码,可能没有找得更细。
TypeError: Cannot read property 'bind' of undefined
at a (weapp.socket.io4.6.1.wx.js:1)
at new q (weapp.socket.io4.6.1.wx.js:10)
at V (weapp.socket.io4.6.1.wx.js:10)
at Object.initSocketClient (initSocket.js:68)
at eval (app.js? [sm]:301)
at H (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:68639)
at eval (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:68861)
at C (eval at n.call.document (runtime.js?devtools_ignore=true:1), :2:38338)

from weapp.socket.io.

kingchen2008 avatar kingchen2008 commented on June 11, 2024

把代码下载下来,重新安装依赖包,我试过 用socket.io-client 4.1.3 包, 可以打包,可以使用。服务器端V4, 要求客户端版本最低是4.1.3.

from weapp.socket.io.

puzzle9 avatar puzzle9 commented on June 11, 2024

高于 4.1.3 的版本好像因为打包问题 直接用不了

from weapp.socket.io.

rayyzhong avatar rayyzhong commented on June 11, 2024

用4.1.3能动,不过webpack build的 development mode可用,用production mode 就出错。
image

from weapp.socket.io.

rayyzhong avatar rayyzhong commented on June 11, 2024

@kingchen2008 老哥能不能贴一个可用版本的上来

from weapp.socket.io.

puzzle9 avatar puzzle9 commented on June 11, 2024

weapp.socket.io.wx-4.4.3.zip

我记得打包的 prod 也行啊

from weapp.socket.io.

rayyzhong avatar rayyzhong commented on June 11, 2024

weapp.socket.io.wx-4.4.3.zip

我记得打包的 prod 也行啊

用你这个还是报一样的错,不过我找到了个方法,虽然大小会占用113KB。

https://github.com/rayyzhong/weapp.socket.io#using-with-socketio-v4-eg-v461

from weapp.socket.io.

puzzle9 avatar puzzle9 commented on June 11, 2024

weapp.socket.io.wx-4.4.3.zip
我记得打包的 prod 也行啊

用你这个还是报一样的错,不过我找到了个方法,虽然大小会占用113KB。

https://github.com/rayyzhong/weapp.socket.io#using-with-socketio-v4-eg-v461

不会吧 我项目中用这个是正常的 没遇到这个错误
可以提供个能复现的demo吗

from weapp.socket.io.

kingchen2008 avatar kingchen2008 commented on June 11, 2024

@kingchen2008 老哥能不能贴一个可用版本的上来
这个是用socket.io-client 4.1.3 打包生成的代码,可以使用。 其实就是把作者的代码下载下面,然后重新npm install依赖包,安装一下 socket.io-client 4.1.3 依赖包,再重新打包就生成这个我贴上来的js文件。

运行package.json文件里面的命令:
build:wechat

weapp.socket.io.wx.zip

from weapp.socket.io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.