-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
bug: Invalid ESM build #152
Comments
Interesting. Does this apply to imports from folders as well? For example with a folder structure like this:
Is |
Maybe you can achieve the It is a little bit confusing at first, but I think this gives a solid explanation (a little bit long 🙂) |
Much appreciated! It seems like hybrid CJS/ES builds are more complicated than I thought. Will look more into this next week. |
Here is some extra information, maybe it will be of some help:
Thank you for looking into it! 🚀 |
There is a fix for this in the |
Thank you for looking into it so fast. I like the solution you chose, it didn't require any actual code change, only replacing the build tool and bundling everything as 1 file. Smart 👍. |
Does bundling everything as 1 file impact tree-shaking? I'm not worried about the bundle size here, just curious if you maybe know or thought about that. |
Thanks! I definitely wanted to avoid having to change every import, update linting rules, and so on. I couldn't find a good way with TSC or SWC to add extensions to the imports at build time, and
I don't think it makes any difference (but don't quote me on that). Currently, the entire bundle is imported regardless (through the root |
Ran into this today. Is a fix on the horizon? |
Will there be a release soon? |
I thought we released this already, but apparently not. We weren't planning to do a release before the next audit (mid April), so I have to figure out if we can release without including the latest PR. |
Thanks for the update. This is the only esm package in |
The ESM build of the library should use the
.js
file extension for relative imports, else it is not a valid ES module.Reference: https://nodejs.org/api/esm.html#mandatory-file-extensions
This also causes issues (MODULE_NOT_FOUND) with tools that support ESM (like Vitest).
Adding file extensions to relative imports should also cause no issues with the CJS build of the package.
The text was updated successfully, but these errors were encountered: