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

Revisit ES Modules support #24

Closed
wildwestrom opened this issue Nov 27, 2021 · 4 comments · Fixed by #29
Closed

Revisit ES Modules support #24

wildwestrom opened this issue Nov 27, 2021 · 4 comments · Fixed by #29

Comments

@wildwestrom
Copy link
Contributor

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

@rasendubi
Copy link
Owner

rasendubi commented Nov 27, 2021 via email

@wildwestrom
Copy link
Contributor Author

wildwestrom commented Dec 12, 2021

This may or may not be related.
In my svelte-kit project I get a warning.

Turns out this message is from vite's server-side-rendering module.

$ npx svelte-kit dev

  SvelteKit v1.0.0-next.201

  local:   http://localhost:3000
  network: not exposed

  Use --host to expose server to other devices on this network

uniorg is incorrectly packaged. Please contact the package author to fix.

There is currently a PR to make the error message more clear.

`${id} is not written in CJS, but also doesn't have "type": "module" or an .mjs extension for the entry point. Please contact the package author to fix.`

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

@bluwy
Copy link

bluwy commented Dec 13, 2021

@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.

@tefkah tefkah linked a pull request Apr 4, 2022 that will close this issue
@rasendubi
Copy link
Owner

uniorg v0.5.0 is now ESM-only 🎉

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

Successfully merging a pull request may close this issue.

3 participants