Skip to content

Not able to load the library in ESM context using named import #82

Description

@Feiyang1

When trying to load the library using and running the script in esm mode:

import { Client } from 'faye-websocket';

I got an error:

SyntaxError: Named export 'Client' not found. The requested module 'faye-websocket' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'faye-websocket';
const { Client } = pkg;

It suggests a workaround by using the default import first, then destruct the import, but it would be nice for the library to provide an esm entry point using the exports field.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions