microsoft/TypeScript-Website

Investigate Reducing Website Build Time

DanielRosenwasser opened this issue · 3 comments

One of the rough parts around onboarding (#2500) is that the site takes so long to produce an initial build. Even an incremental build feels surprisingly fast.

We need to get to the point where our website takes no longer than a minute to build, and no longer than 10 seconds for an incremental change. Ideally we could get better results, but I'm setting a reasonable bar when comparing what we have today.

Achieving this may require some compromises in what the site guarantees today, but we would like to keep around most of the features we have (e.g. sample code validation, error messages, Shiki, etc.). So we should benchmark and see where much of the work here is going, see if there's an easy way to keep these around.

We're not wedded to any specific static site generator, nor any specific approach for operating over data, so that's on the table too.

orta commented

You folks are totally welcome to make the changes you want, but I'd love to know what sort of pages takes longer than 10s to see changes - those numbers for iterating are /wild/ and I'd not want to work with them either

I just loaded up my repo with #2717 up, after bootstrapping and it takes ~5s to boot the dev server via yarn start into the homepage, edits to that are instant, I changed some of the handbook markdown and the edits there were also instant. The dev server loads pages when requested, and all twoslash results are cached in node_modules which is probably making it faster for me though. It looks like a sandbox/playground change can take ~5s to be ready, so if that's the perf hit I'd recommend switching those out those two modules from using tsdx to something using esbuild/swc like tsup which should probably convert those seconds to microseconds

Building the entire site for me takes ~20s via yarn build-site. Perhaps there's a weird linux vs windows thing going on?

If you want to disable twoslash for everyone out of the box for this, you can set TWOSLASH_DISABLE somewhere on process.env and it should be that sort of performance for newbies, and then just have a documented way to get turned off?

Always happy to chat through these things!

Hello! As per #2804, we are automatically closing all open issues. Please see #2804 for a description of what issues and PRs can be accepted going forward.

I keep seeing this in the iteration plans—is there a discussion somewhere that details the idea? The website seems to use an old version of Gatsby. I am interested in remaking the website in a simpler updated stack, same styles, and enhanced a11y. A different design can always be done later.