How does importmaps-rails replace yarn correctly in rails 8?

I write in this post Importmap or jsbundling? I use both

But now I think it’s a bit redundant. Just use esbuild, set multiple entrypoints and split the code to take advantage of the cache.