Skip to content

Import issue (maybe es6 related) #7

@bill-o-more

Description

@bill-o-more

As per documentation, the way to import the MemoryCache class is

import { MemoryCache } from 'memory-cache-node';

which doesn't work because MemoryCache is exported as default - as per MemoryCache.d.ts:

export default class MemoryCache<K, V>

and the above import statement gives SyntaxError: The requested module 'memory-cache-node' does not provide an export named 'MemoryCache' error.

So the import that actually works is

import MemoryCache from 'memory-cache-node';

But then you gotta use it like

const cache = new MemoryCache.MemoryCache<string, number>(30, 50000);

otherwise you get TypeError: object is not a constructor.

I'm using es6 modules, if it's relevant.

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