I am using the production (ol.js) and debug (ol-debug.js) version of OpenLayers 4. The source of these files is the -dist.zip from the releases page (neither npm package was compatible with our browserify workflow).
I am adding a custom tile source, based on ol.source.Zoomify.
The structure of the code is the following (pretty much a clone of Zoomify from ol source code):
var ol = require('openlayers')
var self = (module.exports = {
Gigapan: function(optOptions) {
// ...
var tileGrid = new ol.tilegrid.TileGrid({
extent: extent,
origin: ol.extent.getTopLeft(extent),
resolutions: zoomInfo.resolutions,
})
// ...
ol.source.TileImage.call(this, {
tileClass: myTile,
tileGrid: tileGrid,
tileUrlFunction: gigapanUrlFunction,
})
},
})
ol.inherits(self.Gigapan, ol.source.TileImage)
var myTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
ol.ImageTile.call(this, tileCoord, state, src, crossOrigin, tileLoadFunction)
this.zoomifyImage_ = null
}
ol.inherits(myTile, ol.ImageTile)
myTile.prototype.getImage = function() {
// ...
}
This works perfectly with the -debug version, however raises the following exception when using the production version.
ol.js:16 Uncaught TypeError: Cannot read property 'prototype' of undefined
at Object.v [as inherits] (ol.js:16)
at Object.43../../../assets/non-npm/openlayers/ol.js (viewerTileFormats.js:168)
which points to the second ol.inherits at ol.inherits(myTile, ol.ImageTile).
What is the problem with this code and how can I extend OL4 in such a way that it's compatible with the production build?