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

Can't import typings using TypeScript + NodeJS #294

Closed
crisvp opened this issue Jun 6, 2024 · 2 comments
Closed

Can't import typings using TypeScript + NodeJS #294

crisvp opened this issue Jun 6, 2024 · 2 comments

Comments

@crisvp
Copy link

crisvp commented Jun 6, 2024

When importing the pocketbase package, TypeScript complains that:

The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("change-case")' call instead.

That makes sense, as the package.json file "types" setting is dist/pocketbase.d.mts, which, going by the extension, should be an ES module. Importing the existing cjs export is not an option, as only the client is exported there.

Changing the default entrypoint to dist/pocketbase.cjs.ts appears to work. ES modules should still pick up the module specified in "module"

@crisvp
Copy link
Author

crisvp commented Jun 6, 2024

PR #295

@crisvp crisvp closed this as completed Jun 7, 2024
@crisvp
Copy link
Author

crisvp commented Jun 7, 2024

Found #47 (comment) - closing this.

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

1 participant