Hi,
I was investigating an issue where ts-loader was apparently always rebuilding all the source files in a bundle in watch mode regardless of how small or isolated the changes were. After digging around, I think I found the culprit: the module resolution paths returned by typescript module resolution in the resolveModuleNames LS host function are not normalized. In particular, declaration files in node_modules/@types directory are added once as dependencies to all files, and a second version of the same dependency is added using the unnormalized (unix-style) path for files that actually refer to the module with an import statement. The module with the unnormalized path seems never get actually build, which causes all modules depending on it to always be rebuild when any file changes.
That's the theory I came up with anyway, but I think the fix involves just normalizing the paths returned by the TS module resolution. At least that seemed to fix the issue in my quick test.
Hi,
I was investigating an issue where ts-loader was apparently always rebuilding all the source files in a bundle in watch mode regardless of how small or isolated the changes were. After digging around, I think I found the culprit: the module resolution paths returned by typescript module resolution in the resolveModuleNames LS host function are not normalized. In particular, declaration files in node_modules/@types directory are added once as dependencies to all files, and a second version of the same dependency is added using the unnormalized (unix-style) path for files that actually refer to the module with an import statement. The module with the unnormalized path seems never get actually build, which causes all modules depending on it to always be rebuild when any file changes.
That's the theory I came up with anyway, but I think the fix involves just normalizing the paths returned by the TS module resolution. At least that seemed to fix the issue in my quick test.