Is moving the Babylon.js project to Vite a potentiality?

Is moving the Babylon.js project to Vite a potentiality?

The Babylon.js project uses webpack and jest for building and test running respectively. Is there a possibility that in the future that the project may move to Vite and Vitest?

I believe the anwer is “No” at the moment.

Choose Vite if:

  • You are starting a new project.
  • You are using a modern framework like Vue, React, Svelte, or Lit.
  • Your project relies on a standard setup without highly custom build requirements.

Choose Webpack if:

  • You are maintaining a large, legacy codebase that is already built on Webpack. The cost of migration may not be worth it.
  • You have very specific, complex build needs that rely on a unique Webpack plugin or configuration that doesn’t have a Vite equivalent.

Even those two reasons are enough to not using Vite for Babylon.js codebase.

From my experience, Vite 7 currently may cause a lot of problems for users during the build process. This is the reason why I still use Vite 6 in my Babylon template - GitHub - eldinor/bp800: Babylon.js 8 + Vite 6 Typescript Template with Havok Physics

6 Likes

Thanks @labris .

I had to modify the babylon.js build pipeline for my last PR. Knowing little to nothing about how it works, I spent hours examining the underlying code, scripts, and settings. Now I have a pretty good understanding of how it works.

The Babylon.js build process is so complex and relies so heavily on custom Webpack plugins that I can’t even imagine how huge, extremely difficult and overwhelming it would be to port everything to Vite.

3 Likes

Thanks @roland .

1 Like

@SirFizX may I ask why and what it would solve for you ?

1 Like

have to agree. Vite works well enough if you’re doing something fast and loose but if you need to customize things a little, it’s starts falling apart into a deluge of custom plugins and handlers.

I don’t want to think about all the cruft you’d have to put into the Vite config to handle some of the webpack config uses.

for projects using babylon, it works fine.. but for the core - I wouldn’t.

2 Likes

I don’t have any immediate problems. I had read this article and was curious as to practical realities of moving a robust existing codebase, such as Babylon, over to the Vite build system. As the article mentions, newer does not mean better, and your replies have confirmed that.

I think rspack would be a better fit for Babylon as it is a drop-in replacement for webpack but runs faster, and consumes way less RAM. I had a good experience migrating to it, while trying to migrate to Vite was a nightmare because wasm support is not as good as with webpack/rspack :person_shrugging:

4 Likes

I’ll def. check that out. I’ve just been using vite more and more often but it also gives headaches about some configurations with webpack and esbuild. So much so at times that I’ve ended up writing 20 custom plugins for various pieces that, I don’t feel should have been needed in the first place. It gets cumbersome at times.

1 Like