wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
12.76k stars 1.14k forks source link

Add support for lazy loading Wasp routes #2007

Open infomiho opened 2 months ago

infomiho commented 2 months ago

Quote from here:

Lazy loading is a strategy that defers the loading of non-essential resources until they are needed, reducing the initial loading time and improving the overall performance of the application. In React, we can achieve lazy loading using the lazy function and the Suspense component, introduced in React 16.6.

Our current React Router version (v5) supports using React.lazy: https://ui.dev/react-router-v5-code-splitting so it shouldn't be a big deal to implement this.

We should decide if we want to make this the default behaviour (some frameworks do this) or make it opt in.

Related Discord thread: https://ptb.discord.com/channels/686873244791210014/1236518598231588915/1236518598231588915