I am creating a react-router (v6.4) project with esbuild and have added code splitting in for components, the loaders and actions are inside the same file for better context (same as remix).
However to code split of course I need to do dynamic importing which works fine for the component, but not the loader as this function has to be returned immediately but a dynamic import returns a promise.