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

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #421

Closed
prasanthkarukkuvel opened this issue Dec 20, 2016 · 11 comments
Labels

Comments

@prasanthkarukkuvel
Copy link

prasanthkarukkuvel commented Dec 20, 2016

ts-loader runs out of memory while building. Its seems related to use of enhanced-resolve

`==== JS stack trace =========================================

Security context: 000002F1F9DC9E51
1: forEachBail [D:\Production\fsm-ui-analytics\node_modules\ts-loader\node_modules\enhanced-resolve\lib\forEachBail.js:~5] [pc=000003F65D84C023] (this=000002F1F9DE0D29 ,array=0000038750240011 <JS Array[7]>,iterator=0000038750240079 <JS Function (SharedFunctionInfo 0000006216543CD1)>,callback=00000387502400C1 <JS Function (SharedFunctionInfo 0000006216543D91)>)
2: /* ...`

But adding LoaderOptionsPlugin with options to webpack resolves this issue

new LoaderOptionsPlugin({ options: {} })

Might be because

function makeResolver(options: { resolve: interfaces.Resolve }): interfaces.ResolveSync { return node.create.sync(options.resolve); }

@johnnyreilly
Copy link
Member

Thanks for sharing that. I'm wondering if this is related to #420 - seems likely.

@johnnyreilly
Copy link
Member

I'm pondering whether adding loader options to when constructing the resolver might be a good idea.

@johnnyreilly
Copy link
Member

BTW - which version of WebPack are you using? And can you confirm if the issue occurs when using ts-loader 1.3.1? We used an older version of enhanced-resolve then

@prasanthkarukkuvel
Copy link
Author

@johnnyreilly I am on webpack@2.1.0-beta.28 rite now. With 1.3.1 its failing with TypeError: Cannot read property 'unsafeCache' of undefined without options in LoaderOptionsPlugin

@johnnyreilly
Copy link
Member

Thanks @prasanthkarukkuvel - I'm not totally certain but I think having LoaderOptionsPlugin in play is pretty much mandatory for webpack 2. I'm asking for some guidance on this.

@shepmaster
Copy link

I am experiencing something similar when trying to upgrade ts-loader from 2.3.7 to 3.0.5. I'm using Webpack 3.8.1. If it's useful, you can grab the code and execute yarn build in the ui/frontend directory. I am using macOS (10.12.6) and Node v8.7.0. My computer has 16GB of RAM, and watching the memory usage of the node process, I only see it get to about 1.4GB. What's interesting is that I'm seeing the same behavior trying to upgrade TypeScript from version 2.4.x, but this is without that upgrade.

@shepmaster
Copy link

Perhaps there is a difference in how ts-loader 3.x decides which files to compile? It turns out that I have ~50 MB of files in my build directory and my build directory was not in the tsconfig.json's exclude key. That was causing these files to be compiled even though they aren't referenced from my entrypoint. Perhaps this is what #267 is intended to fix?

@johnnyreilly
Copy link
Member

Don't know why anything we'd have done between 2.x and 3.x would make a difference. Curious..

@stale
Copy link

stale bot commented Jan 19, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

1 similar comment
@stale
Copy link

stale bot commented Mar 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Mar 20, 2019
@stale
Copy link

stale bot commented Mar 27, 2019

Closing as stale. Please reopen if you'd like to work on this further.

@stale stale bot closed this as completed Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants