Skip to content

Instantly share code, notes, and snippets.

@patrickarlt
Last active June 20, 2017 17:40
Show Gist options
  • Save patrickarlt/f4b2c31eefa768c0de15 to your computer and use it in GitHub Desktop.
Save patrickarlt/f4b2c31eefa768c0de15 to your computer and use it in GitHub Desktop.
Babel with the ArcGIS JS API!
require(['./map.js'], function (map) {
// application bootstrap. dojo freaks out if you load a file via a script tag that uses define
// so you can load your appliation here via require.
});
babel map-es6.js --modules amd -o map.js
<!DOCTYPE html>
<html>
<head>
<title>JS API and Babel</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.12/esri/css/esri.css">
<style>
html, body,#map {
width: 100%;
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="http://js.arcgis.com/3.12/"></script>
<script src="boostrap.js"></script>
</body>
</html>
import Map from 'esri/map';
var map = new Map("map", {
center: [-118, 34.5],
zoom: 8,
basemap: "topo"
});
export default map;
"use strict";
define(["exports", "module", "esri/map"], function (exports, module, _esriMap) {
var _interopRequire = function (obj) { return obj && obj.__esModule ? obj["default"] : obj; };
var Map = _interopRequire(_esriMap);
var map = new Map("map", {
center: [-118, 34.5],
zoom: 8,
basemap: "topo"
});
module.exports = map;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment