converting gpx/kml to geojson for large files

I’m working on an arcgis project where users can uplaod gpx/kml to the server and can be viewed in the map, I was able to do it. Unfortunately, there is a specific case where converting the gpx/kml file to togeojson will crash the app if the gpx/kml file is too large. i.e. 5mb+. I’m using 3rd party library (togeojson converter) which can be found here: https://www.npmjs.com/package/@mapbox/togeojson.
1

TL,DR: Does anyone know how to convert gpx/kml to geoJSON for large files (5mb and above)?