Skip to content

Commit

Permalink
chore(ESM CDN): add importmap (#525)
Browse files Browse the repository at this point in the history
  • Loading branch information
andygup authored Jul 23, 2024
1 parent ee7ba9e commit 097b586
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core-samples/jsapi-esm-cdn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Use the ES modules (ESM) via the ArcGIS CDN only for testing and prototyping. Th

For best performance, build your application locally using the [@arcgis/core](https://www.npmjs.com/package/@arcgis/core) npm package. Local build tools, which are typically included in all frameworks, offer the ability to take advantage of tree shaking, chunking, bundling, minimizing and obfuscating in a way that works best for your application.

For more information on using `importmap` see this [MDN article](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap).

## Getting started

📁 **[Click here to download this directory as a ZIP file](https://esri.github.io/jsapi-resources/zips/core-sample-jsapi-esm-cdn.zip)** 📁
Expand Down
15 changes: 11 additions & 4 deletions core-samples/jsapi-esm-cdn/esm-cdn.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
width: 100%;
}
</style>
<script type="importmap">
{
"imports": {
"@arcgis/core/": "https://js.arcgis.com/4.30/@arcgis/core/"
}
}
</script>
<script type="module">
import WebMap from 'https://js.arcgis.com/4.30/@arcgis/core/WebMap.js';
import MapView from 'https://js.arcgis.com/4.30/@arcgis/core/views/MapView.js';
import Bookmarks from 'https://js.arcgis.com/4.30/@arcgis/core/widgets/Bookmarks.js';
import Expand from 'https://js.arcgis.com/4.30/@arcgis/core/widgets/Expand.js';
import WebMap from '@arcgis/core/WebMap.js';
import MapView from '@arcgis/core/views/MapView.js';
import Bookmarks from '@arcgis/core/widgets/Bookmarks.js';
import Expand from '@arcgis/core/widgets/Expand.js';

const webmap = new WebMap({
portalItem: {
Expand Down

0 comments on commit 097b586

Please sign in to comment.