{"id":407062,"date":"2021-02-22T19:59:11","date_gmt":"2021-02-23T03:59:11","guid":{"rendered":"https:\/\/www.esri.com\/about\/newsroom\/?post_type=arcuser&#038;p=407062"},"modified":"2021-02-22T19:59:11","modified_gmt":"2021-02-23T03:59:11","slug":"simplify-integrating-frameworks-and-build-tools","status":"publish","type":"arcuser","link":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools","title":{"rendered":"Simplify Integrating Frameworks and Build Tools"},"author":1031,"featured_media":0,"menu_order":0,"template":"","format":"standard","meta":{"_acf_changed":false,"sync_status":"","episode_type":"","audio_file":"","podmotor_file_id":"","podmotor_episode_id":"","castos_file_data":"","cover_image":"","cover_image_id":"","duration":"","filesize":"","filesize_raw":"","date_recorded":"","explicit":"","block":"","itunes_episode_number":"","itunes_title":"","itunes_season_number":"","itunes_episode_type":"","_links_to":"","_links_to_target":""},"categories":[10722,25002],"tags":[473352,473342,419072],"arcuser_issues":[473092],"class_list":["post-407062","arcuser","type-arcuser","status-publish","format-standard","hentry","category-arcgis-api-for-javascript","category-developers-corner","tag-asynchronous-module-definition","tag-es-modules","tag-productivity","arcuser_issues-arcuser-winter-2021"],"acf":{"short_description":"If you use the ArcGIS API for JavaScript with a 3rd party frameworks or create custom builds of the API, this process just got easier.","pdf":{"host_remotely":false,"file":407152,"file_url":""},"flexible_content":[{"acf_fc_layout":"blockquote","content":"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier. The release of version 4.18 in December introduced a new option for consuming the ES modules, which work natively in the browser, are built to the latest ECMA standards, and allow seamless integration with modern frameworks and build tools."},{"acf_fc_layout":"content","content":"<h2>How Was the API Consumed Before ES Modules Were Available?<\/h2>\r\nThe API has always been available as Asynchronous Module Definition (AMD) modules, and it continues to be available as AMD modules for developers who prefer this format. If your app references Esri\u2019s content delivery network (CDN) to access the API via https:\/\/js.ArcGIS.com\/&lt;API version number&gt;, you are using the AMD version.\r\n<h2>Understanding AMD and ES Modules<\/h2>\r\nWith both AMD and ES modules, API functionality is divided into logical subsets and packaged as modules. AMD modules use a require() method and a third-party script loader to load modules and their dependencies.\r\n\r\nES modules are an official, standardized module system that works natively with all modern browsers through import statements. ES modules do not require a separate script loader. An example showing the differences between the two coding patterns is shown in Listing 1.\r\n\r\n&nbsp;"},{"acf_fc_layout":"image","image":407182,"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"image","image":407192,"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Should You Migrate to ES Modules?<\/h2>\r\nIf you aren\u2019t integrating with a framework or creating custom builds of the API, there is no need to migrate to the new ES modules. The AMD modules will continue to be available alongside the ES modules for the foreseeable future. Both formats have the same capabilities because they are built from the same code base.\r\n\r\nAMD modules are hosted on the CDN and therefore offer these benefits when accessing the API in this manner, as opposed to creating custom builds:\r\n<ul>\r\n \t<li>Fast download and highly optimized caching for API modules<\/li>\r\n \t<li>No installation or configuration required<\/li>\r\n \t<li>It is easy to update applications to the next API version<\/li>\r\n<\/ul>\r\nIf you are integrating with a framework or creating local builds, you should consider using ES modules. This will simplify your implementation as ES modules do not require a separate script loader or additional configuration. When using AMD, you typically either use a webpack plugin to integrate the API into your webpack build or use esri-loader with framework tools or other bundlers.\r\n\r\n<em>Note that you will still want to use AMD modules when creating local builds if your app uses Dojo1 or RequireJS.<\/em>\r\n<h2>Get Started Using ES Modules<\/h2>\r\nWhether you are creating a new application or integrating the API in an existing application, the first step is to install the API using npm with the following command:\r\n<p style=\"font-family: 'Courier New';\">npm install @arcgis\/core<\/p>\r\nThen use import statements to load individual modules. Note that the ES modules package naming convention uses \/core rather than \/esri, which is used by the AMD CDN modules, as shown in Listing 2.\r\n\r\n&nbsp;"},{"acf_fc_layout":"image","image":407202,"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Copy Assets<\/h2>\r\nYou will need to copy the API assets (which includes styles, images, fonts, pre-built API web worker JS files, and localization files) from the @arcgis\/core\/assets folder to your build folder. A simple way to accomplish this is to configure a Node Package Manager (NPM) script that runs during your build process. For example, use npm to install ncp and configure a script in package.json to copy the folder. See the React example in Listing 3.\r\n\r\n&nbsp;"},{"acf_fc_layout":"image","image":407212,"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Configure CSS<\/h2>\r\nThe final step is to set up the CSS. Choose a theme and then configure your code to copy the theme files from @arcgis\/core\/assets\/esri\/themes\/ into your project. Listing 4 provides a React example. Now you can run your build and the API\u2019s ES modules will be bundled along with all your other imports.\r\n\r\n&nbsp;"},{"acf_fc_layout":"image","image":407222,"image_position":"center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<h2>Refactor Code, If Necessary<\/h2>\r\nIf you previously used AMD with esri-loader or arcgis-webpack-plugin and want to migrate to ES modules, review the \u201cBuild with ES modules\u201d help topic in the JavaScript API Guide for the code changes required.\r\n<h2>Documentation and Examples<\/h2>\r\nFor an introduction on developer tooling and your choices when it comes to consuming the API, please visit the JavaScript API Guide and see the Developer Tooling pages. You can find examples that integrate ES modules with frameworks and build tools in the <a href=\"https:\/\/bit.ly\/2VNpmEO\">jsapi-resources GitHub repository<\/a>. This includes integration with Angular, React, Ember, Node, Vue, Rollup, and Webpack.\r\n<h2>Road Map for ES Module Migration<\/h2>\r\nAt version 4.18, ES modules were released as beta. The production release is planned for early 2021. If you try the modules while they are in beta and they meet your app\u2019s requirements, you can use them in your app. The modules have been broadly tested but they are still considered provisional as they could change based yon feedback or an improved design.\r\n\r\nES modules are covered by Esri Technical Support while they are in beta so you can obtain support as needed. If you have feedback on the modules, associated documentation, or sample code, you can submit your comments or questions to the <a href=\"https:\/\/github.com\/Esri\/feedback-js-api-next\">early access repository<\/a>.\r\n<h2>Summary<\/h2>\r\nIf you are using a framework or creating custom builds, use ES modules to make your development work easier. If you are not using a framework or creating custom builds, you don\u2019t need to do anything."}],"references":null},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Simplify Integrating Frameworks and Build Tools<\/title>\n<meta name=\"description\" content=\"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Simplify Integrating Frameworks and Build Tools\" \/>\n<meta property=\"og:description\" content=\"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools\" \/>\n<meta property=\"og:site_name\" content=\"Esri\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2021\/02\/es-modules_banner.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@Esri\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\/\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools\",\n\t            \"url\": \"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools\",\n\t            \"name\": \"Simplify Integrating Frameworks and Build Tools\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/#website\"\n\t            },\n\t            \"datePublished\": \"2021-02-23T03:59:11+00:00\",\n\t            \"description\": \"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.\",\n\t            \"breadcrumb\": {\n\t                \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools#breadcrumb\"\n\t            },\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"BreadcrumbList\",\n\t            \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools#breadcrumb\",\n\t            \"itemListElement\": [\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 1,\n\t                    \"name\": \"Home\",\n\t                    \"item\": \"https:\/\/www.esri.com\/about\/newsroom\"\n\t                },\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 2,\n\t                    \"name\": \"Simplify Integrating Frameworks and Build Tools\"\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/#website\",\n\t            \"url\": \"https:\/\/www.esri.com\/about\/newsroom\/\",\n\t            \"name\": \"Esri\",\n\t            \"description\": \"Esri Newsroom\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\/\/www.esri.com\/about\/newsroom\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/#\/schema\/person\/82e5143bcdebadf8fd64d84e503ca468\",\n\t            \"name\": \"Monica Pratt\",\n\t            \"image\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.esri.com\/about\/newsroom\/#\/schema\/person\/image\/\",\n\t                \"url\": \"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2018\/08\/MonicaMug_agol2.jpg\",\n\t                \"contentUrl\": \"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2018\/08\/MonicaMug_agol2.jpg\",\n\t                \"caption\": \"Monica Pratt\"\n\t            },\n\t            \"description\": \"Monica Pratt is the founding and current editor of ArcUser magazine, the executive editor of ArcNews magazine, the editor of Esri Globe and head of the Publications team at Esri. She has been writing on technology topics, specializing in GIS, for more than 30 years. Before joining Esri in 1997, she worked for newspapers and in the financial industry.\",\n\t            \"sameAs\": [\n\t                \"https:\/\/x.com\/ArcUser\"\n\t            ],\n\t            \"url\": \"\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Simplify Integrating Frameworks and Build Tools","description":"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools","og_locale":"en_US","og_type":"article","og_title":"Simplify Integrating Frameworks and Build Tools","og_description":"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.","og_url":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools","og_site_name":"Esri","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","og_image":[{"url":"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2021\/02\/es-modules_banner.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@Esri","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools","url":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools","name":"Simplify Integrating Frameworks and Build Tools","isPartOf":{"@id":"https:\/\/www.esri.com\/about\/newsroom\/#website"},"datePublished":"2021-02-23T03:59:11+00:00","description":"If you use the ArcGIS API for JavaScript with a third-party framework such as Angular or React or create custom builds of the API, this process just got easier with a new option for consuming the ES modules.","breadcrumb":{"@id":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/about\/newsroom\/arcuser\/simplify-integrating-frameworks-and-build-tools#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/about\/newsroom"},{"@type":"ListItem","position":2,"name":"Simplify Integrating Frameworks and Build Tools"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/about\/newsroom\/#website","url":"https:\/\/www.esri.com\/about\/newsroom\/","name":"Esri","description":"Esri Newsroom","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/about\/newsroom\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.esri.com\/about\/newsroom\/#\/schema\/person\/82e5143bcdebadf8fd64d84e503ca468","name":"Monica Pratt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/about\/newsroom\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2018\/08\/MonicaMug_agol2.jpg","contentUrl":"https:\/\/www.esri.com\/about\/newsroom\/app\/uploads\/2018\/08\/MonicaMug_agol2.jpg","caption":"Monica Pratt"},"description":"Monica Pratt is the founding and current editor of ArcUser magazine, the executive editor of ArcNews magazine, the editor of Esri Globe and head of the Publications team at Esri. She has been writing on technology topics, specializing in GIS, for more than 30 years. Before joining Esri in 1997, she worked for newspapers and in the financial industry.","sameAs":["https:\/\/x.com\/ArcUser"],"url":""}]}},"sort_order":"14","_links":{"self":[{"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/arcuser\/407062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/arcuser"}],"about":[{"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/types\/arcuser"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/users\/1031"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/arcuser\/407062\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/media?parent=407062"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/categories?post=407062"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/tags?post=407062"},{"taxonomy":"arcuser_issues","embeddable":true,"href":"https:\/\/www.esri.com\/about\/newsroom\/wp-json\/wp\/v2\/arcuser_issues?post=407062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}