Skip to content

Commit 550d7f6

Browse files
committed
add 'wrong mapbox-gl version' error
1 parent 8d60a78 commit 550d7f6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/plots/mapbox/constants.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,21 @@
99

1010
'use strict';
1111

12+
var requiredVersion = '0.44.0';
1213

1314
module.exports = {
15+
requiredVersion: requiredVersion,
16+
1417
styleUrlPrefix: 'mapbox://styles/mapbox/',
1518
styleUrlSuffix: 'v9',
1619

1720
controlContainerClassName: 'mapboxgl-control-container',
1821

22+
wrongVersionErrorMsg: [
23+
'Your custom plotly.js bundle is not using the correct mapbox-gl version',
24+
'Please install mapbox-gl@' + requiredVersion + '.'
25+
].join('\n'),
26+
1927
noAccessTokenErrorMsg: [
2028
'Missing Mapbox access token.',
2129
'Mapbox trace type require a Mapbox access token to be registered.',

src/plots/mapbox/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ exports.plot = function plotMapbox(gd) {
5353
var calcData = gd.calcdata;
5454
var mapboxIds = fullLayout._subplots[MAPBOX];
5555

56+
if(mapboxgl.version !== constants.requiredVersion) {
57+
throw new Error(constants.wrongVersionErrorMsg);
58+
}
59+
5660
var accessToken = findAccessToken(gd, mapboxIds);
5761
mapboxgl.accessToken = accessToken;
5862

0 commit comments

Comments
 (0)