Open perliedman opened 6 years ago
👋 @perliedman
We looked at this before in https://github.com/Project-OSRM/osrm-text-instructions/pull/107#issuecomment-302864645.
Some options to fix on your end:
node_modules
Loading language files on-demand in the client might be another solution. This breaks osrm-text-instructions being self-contained though, since the language files need to be served out-of-bounds though.
Hi 😃
Ok, good to know. I'll think about this for a while.
My main concern is that most users of Leaflet Routing Machine (that I hear from) use the pre-built plugin, where it's already too late to exclude the files. Also, I'd prefer to not have to instruct people on how to use their bundlers 😛, but I see your point about the module being self-contained.
In https://github.com/perliedman/leaflet-routing-machine/issues/446, it was reported that the size of Leaflet Routing Machine ends up very large, and examining this it turns out that the languages from
osrm-text-instructions
are a major part of that (at least over 80%).Since a lot of applications will never use more than one language, I can see that this is not ideal.
A lot of other libraries use an opt-in mechanism for languages you need to support, rather than always bundling all of them, which could be one idea to approach this.
Is this something you have thought about? I tried to look for some info on how to exclude languages but didn't find anything, sorry if I missed something obvious.