有没有办法使用 ES6 模块与 ArcGIS 导入模块 API

Is there a way to use ES6 modules to import modules with the ArcGIS API

我目前正在尝试使用 ArcGIS API.

构建 Web 应用程序

This article 似乎暗示在 2020 年的某个时候,API 将获得对 ES6 模块 import/exports.

的原生支持

在那之前,人们如何管理他们的项目?我目前不打算使用 Webpack 或任何框架。 ArcGIS JS 开发人员建议的解决方案是什么?

由于您不打算使用 webpack 或 JavaScript 框架,因此 ArcGIS API for JavaScript CDN (AMD) 是普通 HTML、JavaScript、CSS 申请:https://developers.arcgis.com/javascript/latest/guide/get-api/. There are hundreds of samples that demonstrate the APIs concepts using the CDN https://developers.arcgis.com/javascript/latest/sample-code/

除了上述 Seth 总结中的信息外,ES 模块(测试版)构建将于下个月随 4.18 版本一起提供。您今天可以在 npm. The ES modules build is initially aimed at local builds with a framework, module bundler (e.g. webpack or rollup) or a custom build. Here's a link to a blog post from a few weeks ago that gives an overview of these new modules: https://www.esri.com/arcgis-blog/products/js-api-arcgis/announcements/es-modules-are-coming-soon-in-the-arcgis-api-for-javascript/

上预览 @arcgis/core 模块