07akioni / xicons

SVG Vue/React components integrated from fluentui-system-icons, ionicons, ant-design-icons, material-design-icons, Font-Awesome, tabler-icons and carbon icons. (Vue3, Vue2, React, SVG)
https://www.xicons.org/
1.27k stars 55 forks source link

The `tsc` memory usage problem #861

Open ShookLyngs opened 1 year ago

ShookLyngs commented 1 year ago

I have an existing vite project with @ricons/material and @ricons/antd as devDependencies, and when I ran tsc --diagnostics command , here's the result:

Files:             12372
Lines:            218414
Identifiers:      345716
Symbols:          198770
Types:             16247
Instantiations:    79425
Memory used:    2166158K
I/O read:          0.55s
I/O write:         0.00s
Parse time:        3.74s
Bind time:         1.08s
Check time:        1.10s
Emit time:         0.00s
Total time:        5.91s

Then I added the @ricons/fluent to devDependencies, imported an icon from the library, and then re-ran the command again, here's the result:

Files:             22443
Lines:            268767
Identifiers:      486698
Symbols:          249123
Types:             16248
Instantiations:    79425
Memory used:    3877564K
I/O read:          1.91s
I/O write:         0.00s
Parse time:       10.67s
Bind time:         3.06s
Check time:        4.51s
Emit time:         0.00s
Total time:       18.25s

We can see that with the new icon package added to the devDependencies, the tsc program had to use much more memory than before. How can we resolve it?

ShookLyngs commented 1 year ago

@07akioni After changing all import { A } from '@ricons/xx' to import A from '@ricons/xx/A', the tsc memory used is now normal, but how can I shrink the process and make it simpler? Do you think you can provide a vite plugin to do the job?

kamatil-dev commented 8 months ago

@07akioni