Skip to content

Unable to create Emitter instance in Node #4

@chrisfillmore

Description

@chrisfillmore

fancy-emitter v1.3.6
Node version 14.2.0

I have an empty NodeJS project where I have installed fancy-emitter. This is my code:

import {Emitter} from 'fancy-emitter';
const action = new Emitter();

Running node index.mjs produces the following output:

import {Emitter} from 'fancy-emitter';
        ^^^^^^^
SyntaxError: The requested module 'fancy-emitter' does not provide an export named 'Emitter'

If I change the code to this:

import * as fancy from 'fancy-emitter';
const action = new fancy.Emitter();

I get the following output:

const action = new fancy.Emitter();
               ^

TypeError: fancy.Emitter is not a constructor

How does one use fancy-emitter? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions