Replies: 2 comments 7 replies
-
There is now a lot of code in the repo to support the SSR CJS builds (the scanner, plugin-commonjs, externalization logic, node require hook plugin). But some of these pieces are still needed in case a project has issues with the new discovery scheme during dev and build, or problems with using esbuild optimization during dev. So even if the SSR CJS build would be dropped, we still need them. But I agree that moving forward, the cost of maintaining all these pieces is too high. As an example, we can't yet upgrade to plugin-commonjs v22 and I don't know who is going to spend time doing that now (#7894). I think we have three options:
The problem I see with 3. is that the ecosystem is going to move forward quickly and require support for v3... so we are probably going to leave people behind if they have issues. We may also need more testing and time to go out with 3. instead of 2. My current stance is that we should go with 2., and leave the door open for us to remove these pieces during the next year once we know that the new schemes are good for every user. |
Beta Was this translation helpful? Give feedback.
-
I'm concerned whether the whole CJS compact layer is worth it. I'd say: let's rip the band aid off. There are enough examples of ESM-only environments (e.g. SvelteKit) showing it's possible and, more importantly, worth it to go for ESM-only.
If we go for ESM-only in 12 months with Vite 4, that's 12 more months carrying the whole CJS baggage around. It slows us down. At the end of the day, I see Vite becoming a better tool if we drop CJS with Vite 3 already, because we'll be able to focus on higher priority things than CJS support.
@patak-dev @antfu
Beta Was this translation helpful? Give feedback.
All reactions