stackblitz / tutorialkit

TutorialKit by StackBlitz - Create interactive tutorials powered by the WebContainer API
https://tutorialkit.dev
MIT License
232 stars 22 forks source link

Include app startup into loading time #265

Open eric-burel opened 3 weeks ago

eric-burel commented 3 weeks ago

Is your feature request related to a problem?

Next.js app may take a long time to boot up, especially in dev mode with the first compilation.

In this image, you see that while SWC is being download, and then the app compiled (multiple seconds, it feels forever), you don't see the app as loading but a white screen. Here the terminal helps seeing what happens but usually it's not open, so the end user just feels something is wrong.

image

Describe the solution you'd like.

Be able to make the "loading" step last longer, until the app is actually started.

We have a nice loader but it stops too early, when the Next.js app seems to start, but a few seconds will elapse after the message disappear and the homepage of the app actually appears.

image

Describe alternatives you've considered.

VS Code typically detects when your app is started by parsing the console.log to find a URL, like "app started on localhost:3000" (not perfect but still useful, see this related issue. It's also the idea of start-server-and-test package, used to trigger end to end tests.

We could have a similar regex based solution to detect that the app has started.

On this example, "compiled /" is the right message (Next.js is a tricky case for this feature). image

Additional context

No response