How to properly load Godot in a SPA (web exported game)

Godot Version

4.4.1

Question

I’m re-developing an old website where there was flash games in it. I redeveloped some games, all under godot, and I rebuilt Godot from source to disable unwanted modules (like 3D physics for example)

The godot.wasm still takes like 29 Mb, that’s not that big of a problem, but it is when I switch from one game to another.
Each game is in a separate repository, so I compile 1 game at a time, giving me 1 pck per game.

I use a Vue SPA app, and I tried to minimize user waiting time, but i’m facing freezes each time a game is loaded. (CPU is at 100% for a few secs and i’m on a Mac M2 Max)

Here’s what I tried :

const engineInstance = shallowRef(
  new Engine({
    /* ... my params here, without mainPack */
    executable: '/gamesdata/godot',
    fileSizes: {
      '/gamesdata/godot.wasm': 29107076,
    },
  }),
)
const isEngineLoaded = ref(false)
const currentPck = ref(null)

engineInstance.value.init('/gamesdata/godot').then(() => {
  isEngineLoaded.value = true
})

export function useGodot() {
  const loadPck = async (pckPath, canvasElement, sizeOfPck, args = []) => {
    if (!engineInstance.value || !isEngineLoaded.value) {
      throw new Error('Engine not initialized')
    }
    args = ['--main-pack', pckPath, ...args]

    // Load new PCK
    await engineInstance.value.preloadFile(pckPath, pckPath, sizeOfPck)
    await engineInstance.value.start({
      args,
      canvas: canvasElement.id,
      mainPack: pckPath,
    })

    currentPck.value = pckPath
  }
}

I was testing this to avoid loading multiple times the same wasm in memory, but I figured out that I must call Engine.init() no matter what.

Is there a solution to avoid high CPU usage or to avoid loading the godot wasm multiple times ?
How can I optimize ?

Thanks

Having no answers, I Xposted here