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

ESM exports issue in 3.7.0 #60

Closed
toddheslin opened this issue Jul 8, 2024 · 4 comments
Closed

ESM exports issue in 3.7.0 #60

toddheslin opened this issue Jul 8, 2024 · 4 comments

Comments

@toddheslin
Copy link

toddheslin commented Jul 8, 2024

👋 Hey @derrickreimer thanks for your work on this!

I upgraded to 3.7.0 and had some issues along the lines of:

[vite] Internal server error: [vite] Named export 'trackPageview' not found. The requested module 'fathom-client' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'fathom-client';
const {blockTrackingForMe, load, trackPageview} = pkg;

Unfortunately, I haven't been able to figure out exactly why but it's likely due to cd3d70b

For now I've rolled back to 3.6.0 to keep on moving forward. Given there was no one else who reported this, and a good chunk of people are still using 3.6.0, I thought it would be good to stub an issue for anyone else to contribute their findings:
image

I'm using this package in a Remix app using Vite for build, spitting out ESM. The package.json is set type=module and I've confirmed that it's outputting ESM. For some reason it looks like it's resolving to the cjs version instead of esm.

@derrickreimer
Copy link
Owner

Thanks for the report @toddheslin! I bet you're right about that build process overhaul. I'll take a look at this and try to get a new version cut soon.

@derrickreimer
Copy link
Owner

@toddheslin playing around with some config changes. Could you try pointing your package.json to git://github.com/derrickreimer/fathom-client#3f91c60 (#61) to see if it'll grab the right export?

@toddheslin
Copy link
Author

Yep, that works perfectly. Thanks @derrickreimer you've graduated in the world of pain known as cjs/esm for library authors 😂

@derrickreimer
Copy link
Owner

Great! 😅 version 3.7.1 released.

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