EastCoastGreenwayAlliance / ecg-map

Interactive map and trip planner for the ECGA
https://map.greenway.org
7 stars 0 forks source link

Use async code splitting for loading Geo Router and JSTS #22

Closed clhenrick closed 7 years ago

clhenrick commented 7 years ago

The Geo Routing algorithm developed by @gregallensworth which now exists as a separate Node module contains the entirety of the JSTS library, which is close to 1/2 a MB minified.

Rather than load the Geo Routing module when the page first loads, we could wait until the user performs a search. Upon receiving the search result, we then would check if the Geo Router object exists, if not then load it async, then handle the search result.

Alternatively we can use something like Rollup to create a custom JSTS bundle that only contains the JSTS modules we need. This would result in a smaller file size and probably not warrant code splitting, but would take some time to make sure we grab all the necessary modules.

clhenrick commented 7 years ago

Implemented in aed91c2