Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Jotform is not a constructor #38

Open
jmoyers14 opened this issue Feb 13, 2024 · 1 comment
Open

TypeError: Jotform is not a constructor #38

jmoyers14 opened this issue Feb 13, 2024 · 1 comment

Comments

@jmoyers14
Copy link

I followed the instructions from the readme to import the Jotform class using esm imports

node version 18.19.0

import Jotform from 'jotform'
const client = new Jotform('mytoken')

TypeError: Jotform is not a constructor

Changing to

import JotformPackage from 'jotform'
const Jotform = JotformPackage.default
const client = new Jotform('mytoken')

solves the problem

@wojtekmaj
Copy link

Perhaps related. Looking at arethetypeswrong:
https://arethetypeswrong.github.io/?p=jotform%401.0.1
we can clearly see the package has not been configured correctly to work with CJS and ESM. It all comes down to this line:

exports.default = Jotform;

which is supposed to look like:

module.exports = Jotform;
module.exports["default"] = Jotform;

to ensure maximum compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants