Coder Social home page Coder Social logo

Comments (6)

tylerbutler avatar tylerbutler commented on June 15, 2024 1

I think the root of the problem is that the exports field for the package doesn't define types for the CJS export. I think it should look more like this:

    ".": {
      "import": {
        "types": "./build/esm/index.d.ts",
        "node": "./build/esm-debug/index.js",
        "default": "./build/esm/index.js"
      },
      "require": {
        "types": "./build/cjs/index.d.ts",
        "default": "./build/cjs/index.js"
      }
    },

https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports

I think the types need to be duplicated, too, so that the CJS and ESM types have different paths. I found this somewhere in the Typescript docs but can't find it now, so I might be mistaken.

Patching the exports field manually worked in my project; I can open a PR if it is helpful.

from socket.io-client.

tylerbutler avatar tylerbutler commented on June 15, 2024 1

This should be fixed by 605de78, included in version 4.7.3.

@tylerbutler could you please check?

Sorry for the delay. I confirmed 4.7.3 works for us, and I was able to remove our patched version. Thank you!

from socket.io-client.

darrachequesne avatar darrachequesne commented on June 15, 2024

Hi!

or add the field "type": "module" to '/home/jmarcou/dev/tarot-ai/package.json'.

I think you might be missing the "type": "module" in your package.json file, could you please check?

from socket.io-client.

Julien-Marcou avatar Julien-Marcou commented on June 15, 2024

Yes, it's a possible solution, but then I need to rewrite my entire project to be compatible with ESM, which is not the case at the moment.

For instance, all my imports doesn't specify the file extension, if I switch to "type": "module", then I need to fix all my imports.

Isn't socket.io-client supposed to behave as socket.io when imported on a Node.js project ?

from socket.io-client.

luisdeka avatar luisdeka commented on June 15, 2024

waiting for this...

from socket.io-client.

darrachequesne avatar darrachequesne commented on June 15, 2024

This should be fixed by 605de78, included in version 4.7.3.

@tylerbutler could you please check?

from socket.io-client.

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.