Speedup recompile times

Hey gang, I have a need, a need for speed.

I’m using web pack to compile my Babylonjs with typescript. My Initial load is about 28000ms (which I don’t care about) but reloads when I change a single var is around 2000 ms to 7300 ms.

Is there any web pack settings or ways to talk to Babylon to avoid this? The game performance is good and no issues, this is a recompile issue.

Adding @RaananW our Build Wizard.

Webpack has its limitations. 2 seconds hot-reload sounds reasonable. 7 seconds - well, depends what you are changing :slight_smile:

It also depends on your project structure. The more async-loading you have, the more webpack needs to work to decide what belongs where. of course, it has its caching mechanism whichs hould work rather well, but if you change something in one of the async-loaded packages it might need to recompute some of the packages.
There are ways to make things a little faster. for example, do not run type-schecking when compiling typescript during dev. That means - you trust your IDE to show you errors, and webpack (and the ts-loader) does not check them. This is recommended JUST for dev mode, of course. It’s of course needed when building for production.
Otherwise - you can try switching to swc-loader instead of ts-loader (and babel, if you use it). It’s experimental, but has proven to be a lot faster on large code-bases.
AND! sourcemaps, of course. I am not sure what sourcemaps you are using, but make sure you are choosing one of the faster methods (usually called “cheap”), otherwise it will take some time to process.

I hope this helps!

3 Likes

In your ts-loader config , add the option “transpileOnly: true” , which will disable type checking. To check types, you can just use tsc in a separate process. Ts loader is poorly made, and idk if still true, but at one point it created a ts program for every file. Also if you’re using create react app it might be slower than normal because it resolves every file to make sure its not outside of your current project directory, which is slow.

2 Likes