-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
ts-loader is hanging while consuming huge amounts of memory #420
Comments
Thats interesting. My own seem to be fine. I would speculate this is related to using webpack's newer enhanced-resolve. Since we have a need to use enhanced-resolve I'm not sure what to suggest.. |
If you add in the loader options plugin as suggested in #421 does this resolve the issue? |
@pelotom can you provide TSC's diagnostics with If your project is large, it's probable that tsc marginally get compilation done with 1GB heap memory limit. ts-loader usually requires more memory than plain tsc. |
@johnnyreilly I'm still using WebPack 1.14.0, and @HerringtonDarkholme
|
Yes - loader op |
Yes loader options is for WebPack 2. Could you share a minimal repro? |
Unfortunately this is a private company repo. I'm not sure how to make a minimal example from it that doesn't effectively open source the project 😛 |
Tricky but I understand. I suggest you fork, have a play around and attempt to fix. I recommend taking a look at the part of the code that uses enhanced-resolve as it's likely that's the issue. We'd certainly appreciate a PR if you're successful. |
This is where you probably want to focus: https://github.com/TypeStrong/ts-loader/blob/master/src/resolver.ts https://github.com/TypeStrong/ts-loader/blob/master/src/servicesHost.ts |
One other thing to try; might be worth commenting out these lines: https://github.com/TypeStrong/ts-loader/blob/master/src/index.ts#L72-L74 See if that makes a difference before you try the other bits. This was a micro optimisation I added in 1.3.3; it probably wasn't worth it anyway but it might be a cause to look at. |
@johnnyreilly It can't be related to anything that was added or removed in 1.3.3 because the problem was introduced in 1.3.2. |
@pelotom Thanks for the diagnostics. It shows totally reasonable memory consumption. So that's really resolve problem I think. I would suggest you to clone the repository, |
Good idea, I'll do that and report back. |
Bisecting tells me 3b4b83d introduced the problem. |
Thats interesting. So the problem actually lies with enhanced resolve by the sounds of it. Could you raise an issue here: https://github.com/webpack/enhanced-resolve |
I figured out a workaround which may help illuminate what's going on. As part of our build process we import { something } from 'foo/some/module/path' On a hunch that this unorthodox practice of ours might be why no one else has noticed this, I got rid of the // tsconfig.json
{
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"foo/*": ["src/foo/*"],
"bar/*": ["src/bar/*"]
}
}
} in conjunction with WebPack's { // webpack.config.js
// ...
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx', ''],
root: path.resolve('./src'),
},
// ...
} This achieved the same effect as the So there is apparently some bad interaction between |
I guess this might be a cyclic directory problem for |
Thanks @HerringtonDarkholme and @johnnyreilly. Closing as I think this can be considered resolved as far as |
Thanks for investigating and reporting back @pelotom - that's always helpful. 👍 |
As of version 1.32 and 1.33,
ts-loader
hangs while consuming much more memory than usual when I try to compile my relatively large TypeScript project. Runningtsc
directly works fine, as doests-loader
v1.31 and earlier.The text was updated successfully, but these errors were encountered: