-
Notifications
You must be signed in to change notification settings - Fork 308
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
CommonJS import error #321
Comments
Yeah, the export of the commonjs module is a Mixpanel library instance. It won't work to call individual methods without any binding to their instance. |
So would you suggest using the default import instead? |
Yes, the default export should work for you. It's the only one we document. I think it might be a pretty simple update for the lib to export a named version as well so you could do import {mixpanel} from 'mixpanel-browser'; |
Related to microsoft/TypeScript#45813
using the import syntax with mixpanel and typescript 4.4+ fails
using the default import works well though, but it is discouraged by linting rules such as https://github.com/import-js/eslint-plugin-import/blob/v2.25.2/docs/rules/no-named-as-default-member.md
The text was updated successfully, but these errors were encountered: