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

Kill CJS #5839

Closed
4 tasks done
brillout opened this issue Nov 25, 2021 · 9 comments · Fixed by #8178
Closed
4 tasks done

Kill CJS #5839

brillout opened this issue Nov 25, 2021 · 9 comments · Fixed by #8178
Labels
enhancement: pending triage p2-to-be-discussed Enhancement under consideration (priority)

Comments

@brillout
Copy link
Contributor

Clear and concise description of the problem

CJS is alive.

Suggested solution

Kill it. By transitioning following tools to ESM-only.

This will effectively force the entire ecosystem to transition to ESM.

Note that old CJS packages can stay as-is and don't need any changes for the forseeable future. (But if they update one of their dependencies then they'll be forced to switch to ESM.)

Let's rip the band-aid off :-).

Explanation of why this will work: #4340 (comment).

Alternative

None 😉.

Additional context

No response

Validations

@brillout
Copy link
Contributor Author

@patak-js

I would also like a pure ESM world, but it is indeed painful. We can't update several deps because of this in Vite. And Jest is playing against us segfaulting in CI because of ESM issues right now... I hope we can switch away from it soon

This ticket solves that problem.

@pi0
Copy link
Contributor

pi0 commented Nov 25, 2021

You can put a ✅ on Nuxt3. All packages are in ESM only format since nuxt/framework#539.

BTW we have to keep supporting cjs deps for time being until ecosystem is more prepared (notably Jest, Typescript and Node.js for under-the-flag features) :)

@Shinigami92
Copy link
Member

Vite 3.0?

@Shinigami92
Copy link
Member

Shinigami92 commented Jan 28, 2022

Vite 4.0? 😅

We need a smooth transition from cjs to esm.
We should not force the community to switch right now, cause this would break many things.

@patak-dev patak-dev removed this from the 3.0 milestone Jan 28, 2022
@patak-dev patak-dev added the p2-to-be-discussed Enhancement under consideration (priority) label Feb 25, 2022
@aladdin-add
Copy link

it would be good to support esm plugins in vite 3.0, so the ecosystem can gradually move to esm.

we can imagine dropping cjs support at some point (vite v4/v5...) when the community is ready to accept. :)

@Shinigami92
Copy link
Member

it would be good to support esm plugins in vite 3.0, so the ecosystem can gradually move to esm.

we can imagine dropping cjs support at some point (vite v4/v5...) when the community is ready to accept. :)

Feel free to open a PR that supports both types of plugins: cjs and esm

@benmccann
Copy link
Collaborator

We should not force the community to switch right now, cause this would break many things.

I'm curious what you anticipate would be problematic. We've been supporting ESM-only for SvelteKit and have found it to be fairly smooth overall.

@patak-dev
Copy link
Member

In Vite v3, Vite will migrate to ESM (with CJS compat), the SSR build will also be ESM by default (with the current CJS SSR build as opt-in), and Vitest is used instead of Jest:

We can close this issue for the moment to avoid having a generic request for a long time in the tracker. We think that going ESM-only isn't the best for the ecosystem right now, but Vite will make big steps towards that future in v3.

@patak-dev patak-dev closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2022
@patak-dev patak-dev closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2022
@brillout
Copy link
Contributor Author

brillout commented Jun 1, 2022

I believe we should drop CJS support already in Vite 3, see #8432.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement: pending triage p2-to-be-discussed Enhancement under consideration (priority)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants