The WebPack module's resolution algorithm

The resolve option specifies how WebPack resolves module names. The WebPack loaders  bundling TypeScript files subsection already introduced its extensions sub-option that specifies how to complete paths with no extension:

resolve: { extensions: ['.js', '.ts'] }

All extensions specified in the array are tried, in the order they are listed, until an existing file is found.

As already discussed in the Modules loading section of Chapter 6, Namespaces and Modules, absolute and relative paths are trivially solved. The difficult part is solving non-relative paths. The alias sub-option is analogous to the TypeScript path option, the main difference being that paths in path are relative to the path contained ...

Get Hands-On TypeScript for C# and .NET Core Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.