projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.71k stars 1.18k forks source link

remove mathjs, use ml-matrix in place for much smaller bundle size #651

Closed siosphere closed 4 years ago

siosphere commented 4 years ago

Checklist

What?

This swaps out mathjs for ml-matrix, reducing the bundle size dramatically.

Why?

The geometry package was using mathjs which added ~2MB (10MB unpacked) to final build size, even though we only use a fraction of what mathjs provides.

How?

Because it was only using basic matrix math, swapping it for a much smaller library was easy to do

siosphere commented 4 years ago

Okay, so, I ran "yarn run pretty" and it changed tons of files in the repo that I didn't touch....so I opted not to run it, I'm not sure why it was updating so many things

flieks commented 4 years ago

Hi after upgrading i get this now:

./node_modules/@projectstorm/geometry/dist/es/Point.js Module not found: Can't resolve 'ml-matrix' in '\node_modules\@projectstorm\geometry\dist\es'

removing node modules and reyarn didnt help

renato-bohler commented 4 years ago

Hi after upgrading i get this now:

./node_modules/@projectstorm/geometry/dist/es/Point.js Module not found: Can't resolve 'ml-matrix' in '\node_modules@projectstorm\geometry\dist\es'

removing node modules and reyarn didnt help

You have to add ml-matrix to your project's dependencies. Also, if you aren't using mathjs for anything else, you can remove it.

See this update commit on my project for reference: https://github.com/renato-bohler/logossim/commit/a835d4e009a834c6a627fdf922a22a5dc814bab4

flieks commented 4 years ago

Thanks that worked!