ArcGISPack
Bundle the ArcGIS API for you
examples:
- React: https://codesandbox.io/s/k30nlqkr37?module=%2Fsrc%2FReactSceneView.js
- Vue: https://codesandbox.io/s/jp5vojwmov?module=%2Fsrc%2Fcomponents%2FMapView.vue
- create-react-app : https://github.com/g3r4n/arcgispack-cra-example
How to use it ?
1- Add your arcgispack bundle to your application
You can use either a custon build or the ful build from the CDN.
<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/g3r4n/[email protected]/esri-bundle/bundle.js"></script>
<!-- uncomment the line below for local build -->
<!-- <script type="text/javascript" src="esri-bundle/bundle.js"></script> -->
Create your own bundle :
- add the package
Add arcgispack
as a dev dependency:
npm i -D arcgispack
or
yarn add -D arcgispack
- create the arcgis.config.js in the root folder
https://github.com/g3r4n/arcgispack-cra-example/blob/master/arcgis.config.js
- update the configuration to match your needs
outputPath
: folder where the API build will generatedojoModules
: Array of API dojo modules to build and to access through the lib entry
- generate a build (or update your package.json to create a task see here )
npx arcgispack
- Build your amazing app as you wish without tradeoff
2- Add your arcgispack bundle to your application
Use arcgis-wrapper to get modules from the ArcGIS JS API
import { Map, SceneView, SceneLayer } from "arcgis-wrapper";
Why ?
@arcgis/webpack-plugin got the following tradeoff :
- you can't use creaste-react-app or other tools/template without changing the underlining configuration
- you can't use another bundle tool other than webpack
- you have to deal and understand webpack config
Using this tool to bundle the API let you build the application as you want without tradeoff.
TODO
- Have the babel configuration in the tool to avoid saving the existing babel et reatoring the babel configuration
- Change the DEFAULT_LOADER_URL in the esriconfig
- Change DEFAULT_WORKER_URL in the esriconfig
- restore copy of babel config in case of error
- make it completely configurable
- create a verbose and normal mode to limit the output list