-
Notifications
You must be signed in to change notification settings - Fork 25
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
Revisit ES Modules support #24
Comments
I would love to have dual cjs/mjs support, but it is more complicated than
described in the post.
1. unified ecosystem has moved to esm-only, not dual. And you cannot
provide a (dual) cjs module that works with esm-only.
2. While transitioning to esm-only, unified has also introduced other
breaking changes—the API has changed.
Supporting both cjs/mjs at this point would require maintaining two major
versions of uniorg in parallel, which I don't think is worth the effort.
|
This may or may not be related. Turns out this message is from vite's server-side-rendering module.
There is currently a PR to make the error message more clear.
That makes things a little clearer though. Luckily vite does support commonjs, but it seems like your build doesn't create something recognizable as commonjs. Here's the vite source that checks this specifically. https://github.com/vitejs/vite/blob/main/packages/vite/src/node/ssr/ssrExternal.ts#L166 |
@wildwestrom The message you get from Vite is a bug there, it should be fixed by vitejs/vite#6053 soon. So I don't think it's related to this issue, though ES Modules support is still something nice to have. |
uniorg v0.5.0 is now ESM-only 🎉 |
Looks like Next.js now has ES modules support; https://nextjs.org/blog/next-12
Gatsby still doesn't unfortunately... gatsbyjs/gatsby#31599
However, would you consider making it so that we can use ES modules now?
I don't think there's any workaround with Svelte, which uses ES modules exclusively.
I'm getting a little better at Javascript, so maybe I could help implement one of the solutions proposed in this article.
https://redfin.engineering/node-modules-at-war-why-commonjs-and-es-modules-cant-get-along-9617135eeca1
The text was updated successfully, but these errors were encountered: