-1

Openlayers is a very nice package for working with maps.

My Spring Boot, Angular and Leaflet SPA has a vendor.js file of 4.2Mb. Replacing Leaflet by Openlayers 5 gives a vendor.js of 6.8Mb. Noticed differently: adding Openlayers to a bare Angular SPA increases the SPA by about 3Mb.

When I see many examples at https://openlayers.org only 2 files are included: ol.css and ol.js. When downloading the Openlayers v5 zip, then I can see that the files are only 4kb and 640Kb.

Why has the Single Page Application (SPA) download size increased by about 2.6Mb? Other *.js files increased also a bit. The application did not change.

I used the "npm install ol --save" to add Openlayers v5 to the Angular SPA.

Of course I can use the ng build --prod to optimize the build (sizes).

tm1701
  • 7,307
  • 17
  • 79
  • 168
  • You are probably seeing the difference between the sizes of the minified ol.js and the unminified source. Comparing the ol.js and ol-debug.js for version 4.6.5 (the last time an unminified full build was included in a release) the sizes were 530KB and 2613KB – Mike Mar 12 '19 at 23:41
  • Thank you for your answer. I will try to build it tonight with the --prod argument. – tm1701 Mar 13 '19 at 16:54

1 Answers1

0

@Mike - thank you for pointing the way!

When building for production with --prod any doubts vanished. The total size is about 1.5M! That's OK!

tm1701
  • 7,307
  • 17
  • 79
  • 168