Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide static browser/node targets #599

Merged
merged 2 commits into from
Sep 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
"main": "dist/es5/index.js",
"module": "dist/esm/index.js",
"esnext": "dist/es6/index.js",
"browser": {
"dist/es5/utils/mapboxgl.js": "dist/es5/utils/mapboxgl.browser.js",
"dist/esm/utils/mapboxgl.js": "dist/esm/utils/mapboxgl.browser.js",
"dist/es6/utils/mapboxgl.js": "dist/es6/utils/mapboxgl.browser.js"
},
"files": [
"src",
"dist"
Expand All @@ -40,7 +45,7 @@
"bowser": "^1.2.0",
"mapbox-gl": "0.47.0",
"math.gl": "^2.0.0",
"mjolnir.js": "^1.2.1",
"mjolnir.js": "^2.0.0-alpha.1",
"prop-types": "^15.5.7",
"viewport-mercator-project": "^5.1.0"
},
Expand Down
4 changes: 1 addition & 3 deletions src/components/static-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ import {normalizeStyle} from '../utils/style-utils';
import WebMercatorViewport from 'viewport-mercator-project';

import Mapbox from '../mapbox/mapbox';
import isBrowser from '../utils/is-browser';
import mapboxgl from '../utils/mapboxgl';
import {checkVisibilityConstraints} from '../utils/map-constraints';

const mapboxgl = isBrowser ? require('mapbox-gl') : null;

/* eslint-disable max-len */
const TOKEN_DOC_URL = 'https://uber.github.io/react-map-gl/#/Documentation/getting-started/about-mapbox-tokens';
const NO_TOKEN_WARNING = 'A valid API access token is required to use Mapbox data';
Expand Down
18 changes: 0 additions & 18 deletions src/utils/is-browser.js

This file was deleted.

22 changes: 0 additions & 22 deletions src/utils/is-electron.js

This file was deleted.

1 change: 1 addition & 0 deletions src/utils/mapboxgl.browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from 'mapbox-gl';
1 change: 1 addition & 0 deletions src/utils/mapboxgl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default null;
7 changes: 4 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5339,10 +5339,11 @@ mixin-deep@^1.2.0:
for-in "^1.0.2"
is-extendable "^1.0.1"

mjolnir.js@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-1.2.1.tgz#ab3237afc5fbbc8aa4bafc965b10735c4bf8328c"
mjolnir.js@^2.0.0-alpha.1:
version "2.0.0-alpha.1"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.0.0-alpha.1.tgz#5721f7864cf33d3e2aa5828659a28fcd1b2f8197"
dependencies:
"@babel/runtime" "^7.0.0"
hammerjs "^2.0.8"

mkdirp@0.5.1, mkdirp@0.5.x, "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0:
Expand Down