Skip to content

Uncaught TypeError: Clockify is not a constructor #13

@Akatroj

Description

@Akatroj

When using import Clockify from 'clockify-ts' in an .mjs file and trying to use it, I'm getting an error:

const test = new Clockify('');
             ^

TypeError: Clockify is not a constructor

My entire project setup:

index.mjs
import Clockify from 'clockify-ts';

const test = new Clockify('');
package.json
{
  "main": "index.mjs",
  "dependencies": {
    "clockify-ts": "^1.2108.13"
  },
  "scripts": {
    "start": "node ."
  }
}

I can get this to work by using

import * as Clockify from 'clockify-ts';

const test = new Clockify.default.default(''); // doubled .default !!!

but I think you should fix your build config, because clearly something is wrong.

I see this was already reported in #12 - however the issue was resolved as OP thought it was a problem with his project config. I believe the problem lies in this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions