UPDATE: This technique demonstrated in this repository will work, but you should probably use either:
- the newer @arcgis/webpack-plugin with the ArcGIS API v4.7+
- or esri-loader with the ArcGIS API v3.x - v4.6
Read this blog post for more information.
Running the demo
npm install npm run build
Then serve the root folder using your favorite web server, such as http-server and open src/app/index.html in a browser.
How it works
- configure webpack to output the bundle as an AMD module
- exclude Esri and Dojo modules from the local build
After you've taken these steps you will be able to use ES2015 import statements like
import Map from 'esri/map'; to reference Esri modules.
Integrating with other libraries
For any non-Dojo libraries (jQuery, d3, etc) you can include them in your webpack bundles as you normally would.
For Dojo libraries you will need to take a few additional steps:
- configure the Dojo loader with the location of the package
- exclude the package from the local build
Known limitations of this approach
If either of those are requirements for your application, you can try the approach demonstrated in esri-angular-cli-example.