-
Notifications
You must be signed in to change notification settings - Fork 343
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
ES module import issue #202
Comments
I have the exact same issue. |
This seems to be a problem in blurhash package.json. To fix it, I had to edit node_modules/blurhash/package.json and added the line: Then you can use object deconstruction to import blurhash
|
I'll look into this, when I have some time. |
Confirmed, similar issue here. I'm writing a Vite plugin that leverages blurhash and get:
The issue is detailed above but I thought provide the exact issue as seen with my bundler. I reverted to 1.1.3 which has the correct export. Using 2.0.0 is blocked until the export detailed above is resolved. Thanks for maintaining this neat project. |
Hi all 👋🏼 Please try out 2.0.1 and let me know if that resolves your issues. |
@Thisen am using 2.0.1 and same issue. Looks like is still loading the CJS version in Vite, giving error: |
Could you provide me with a reproduction? |
@Thisen sure... Note that this repro excludes 'blurhash' from optimizing the default CJS file to ESM... |
Thank you for the reproduction! It helped me to resolve the issue and it should work in |
It seems to be currently broken (and 2.0.2 doesn't seem to be working either), see: woltapp/blurhash#202
It seems to be currently broken (and 2.0.2 doesn't seem to be working either), see: woltapp/blurhash#202
It seems to be currently broken (and 2.0.2 doesn't seem to be working either), see: woltapp/blurhash#202 adeira-source-id: c28a421e4a6e5e49bff6d071454ac1474b754896
#210 pointed out in exports field order, try |
@mrtnzlml I see you had some issues, could you try out 2.0.3? :) |
@Thisen this is resolved for me in latest version. |
Awesome! Closing. |
Hi @Thisen! 👋 There is still some breaking change in the patch release, as you can see in this PR: adeira/universe#5088 The situation got better. I can start the application with |
I can't speak into that. I'd need a new issue with a reproduction :) |
I'm seeing this as well. Jest tests break at 2.0.3. @mrtnzlml did you find a workaround? |
Ok I see that adding |
A new issue with a reproduction would be great. 👍🏼 |
@janpe I didn't have time to check it yet or prepare a repro. Thanks for the suggested workaround! 👏 It is certainly a breaking change in a patch release. 😞 |
Hi guys, newbie JS developer here.
I've been using this framework in a nodejs app for quite a while and decided to update the server to use ES modules. All went great with all the dependencies that I had in the project but when I got to import the encode func, nodejs complains about the package being a CommonJS module, even thou... I don't think thats true.
import { encode } from "blurhash";
- this ends up with a _SyntaxError: Named export 'encode' not found. The requested module 'blurhash' is a CommonJS module... _ erorrand if I do this:
import blurhash from "blurhash";
- I end up with a SyntaxError: Unexpected token 'export' error.Does anyone have any idea what this happens?
Thanks a lot and sorry of this is a stupid question.
Later edit: This problems seems to be happening only with the 2.0.0 version, the 1.1.5 works fine.
The text was updated successfully, but these errors were encountered: