Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@types declarations mess up incremental builds on Windows #372

Closed
smphhh opened this issue Nov 13, 2016 · 3 comments
Closed

@types declarations mess up incremental builds on Windows #372

smphhh opened this issue Nov 13, 2016 · 3 comments

Comments

@smphhh
Copy link
Contributor

smphhh commented Nov 13, 2016

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.

@johnnyreilly
Copy link
Member

Cool - we'd love it if you could send us a PR and we'll take a look!

@smphhh
Copy link
Contributor Author

smphhh commented Nov 13, 2016

Ok I can probably send a PR tomorrow.

@johnnyreilly
Copy link
Member

Sweet - I look forward to it!

smphhh added a commit to smphhh/ts-loader that referenced this issue Nov 14, 2016
smphhh added a commit to smphhh/ts-loader that referenced this issue Nov 14, 2016
smphhh added a commit to smphhh/ts-loader that referenced this issue Nov 14, 2016
smphhh added a commit to smphhh/ts-loader that referenced this issue Nov 14, 2016
smphhh added a commit to smphhh/ts-loader that referenced this issue Nov 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants