This change switches the initial loading of TypeScript into memory from synchronous to asynchronous, and avoids using fs.existsSync in the Service Host if we already have the file in memory.
For most setups this probably won't make much of a difference, but my project runs in Docker Desktop for Mac, which has a long standing issue with slow, CPU-intensive file IO in mounted folders, so it is necessary to keep build times reasonable. Moving to async for most of the filesystem operations keeps Webpack from pausing each time this loader is invoked.
This change switches the initial loading of TypeScript into memory from synchronous to asynchronous, and avoids using
fs.existsSync
in the Service Host if we already have the file in memory.For most setups this probably won't make much of a difference, but my project runs in Docker Desktop for Mac, which has a long standing issue with slow, CPU-intensive file IO in mounted folders, so it is necessary to keep build times reasonable. Moving to async for most of the filesystem operations keeps Webpack from pausing each time this loader is invoked.