bjnsn
bjnsn

Reputation: 2820

When creating a custom build for OpenLayers3 some methods are obfuscated

When creating an OL3 build based on https://github.com/openlayers/ol3/blob/master/config/ol.json I am able to access the ol.Map#renderSync prototype method. However, if I use the following custom "exports": [...] array (to trim library size), #renderSync is obfuscated (or perhaps removed):

[
    "ol.Map",
    "ol.View",
    "ol.control.*",
    "ol.interaction.*",
    "ol.style.*",
    "ol.layer.Tile",
    "ol.layer.Group",
    "ol.source.XYZ",
    "ol.layer.Layer",
    "ol.layer.Vector",
    "ol.format.GeoJSON",
    "ol.source.Vector",
    "ol.Overlay",
    "ol.has.*",
    "ol.events.condition.*",
    "ol.inherits"
]

How can I export a custom, trimmed down, build without losing access to ol.Map#renderSync while (ideally) retaining closure ADVANCED optimization?

Upvotes: 1

Views: 248

Answers (1)

Jonatas Walker
Jonatas Walker

Reputation: 14150

Any ol.Map method you want to use, add it to exports section:

"exports": [
  "ol.Map",
  "ol.Map#updateSize",
  "ol.Map#renderSync",
  "ol.View",
  "ol.View#*",
  ...
]

Or use an asterisk to export all methods:

"exports": [
  "ol.Map",
  "ol.Map#*",
  ...
]

Upvotes: 2

Related Questions