-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Maximum call stack size exceeded when a single file has many exports #38691
Comments
Looking at the compiled output of a smaller test case, I see this additional statement in 3.9 that did not exist in 3.8: exports.exp3 = exports.exp2 = exports.exp1 = void 0; This was introduced in #37093 and appears to be calculated recursively, which I suspect causes this stack overflow. CC @weswigham |
Hm, we'd need to emit it as a list of some kind of we wanted to avoid a stack overflow here. (As if we're overflowing during construction, we'll obviously overflow during printing, too). @rbuckton do you have a preference for listifying a long chain of assignments like this? We could generalize |
@weswigham I don't see a problem with that, although |
@weswigham Do you have any update on when you might be able to push a fix for this? This is unfortunately still blocking my team's move to TS3.9, but we're really excited to try out the performance improvements. |
* Fixes stack overflow when exporting a lot in commonjs Fixes #38691 * Add missing test files
* Fixes stack overflow when exporting a lot in commonjs Fixes microsoft#38691 * Add missing test files
- Default TypeScript version is 4.0.3 Added - Workaround for TS 3.9 and TS 4.0 bug microsoft/TypeScript#38691 Fixed - exportStar helper now binds exports making them mockable.
…t is really needed for some code.
Was this ever released in |
It was fixed in 4.1. |
TypeScript Version: 3.9.2 (as well as the nightly)
Search Terms: RangeError maximum call stack size exceeded commonjs exports
Code
When a single file has thousands of exports and
"module"
is set tocommonjs
in tsconfig, the compiler crashes with a "Maximum call stack size exceeded" error. This is a TS 3.9 regression.Collapsed code sample
Expected behavior: The compiler does not crash.
Actual behavior: The compiler crashes with "RangeError: Maximum call stack size exceeded."
When run on a similar example locally:
When run on the Playground:
Playground Link:
TS 3.9 + CommonJS (Crashes)
TS 3.9 + ESNext (Works)
TS 3.8 + CommonJS (Works)
Related Issues:
N/A
The text was updated successfully, but these errors were encountered: