TypeScript Version: 3.1.0-dev.20180925
git clone --depth=1 https://github.com/zuiidea/antd-admin.git
cd antd-admin
tsc --init
tsc --allowJs --checkJs
Compiler crashes with the callstack:
RangeError: Maximum call stack size exceeded
at Object.isRequireCall (node_modules\typescript\lib\tsc.js:7304:27)
at collectDynamicImportOrRequireCalls (node_modules\typescript\lib\tsc.js:69739:24)
at visitNode (node_modules\typescript\lib\tsc.js:12689:24)
at Object.forEachChild (node_modules\typescript\lib\tsc.js:12890:24)
at collectDynamicImportOrRequireCallsForEachChild (node_modules\typescript\lib\tsc.js:69754:20)
at collectDynamicImportOrRequireCalls (node_modules\typescript\lib\tsc.js:69748:17)
at visitNode (node_modules\typescript\lib\tsc.js:12689:24)
at Object.forEachChild (node_modules\typescript\lib\tsc.js:12890:24)
at collectDynamicImportOrRequireCallsForEachChild (node_modules\typescript\lib\tsc.js:69754:20)
at collectDynamicImportOrRequireCalls (node_modules\typescript\lib\tsc.js:69748:17)
antd-admin includes a machine-generated JS file. The bulk of the file is single gigantic expression that adds a bunch of strings.
There are two ways to fix this:
@sandersn option2 might not work with incremental parser?
@weswigham suggests:
And, also
grep import combined with a filter over all nodes that match.I did (4) in the branch fix-overflow-in-collect-dynamic-import, which fixes the original crash.
But a test case now stack overflows in the binder, so I started on (3). This turns out to be a big task, because everywhere we handled BinaryExpression, we now have to handle OperatorListExpression as well. This turns out be quite a few places.