ArcGIS API for JavaScript 4.x and NPM

Source: Internet
Author: User
Tags install node

In the 4.7 release, it was good news not only to increase the rendering support for WEBGL (rendering front-end speed and rendering volume), to enhance promises syntax support in ES6, but also to support NPM management and webpack packaging.

"means that you can introduce JSAPI without esri-loader This package," said--arcgis.

Currently not yet adjourned
1. Preface

If you want to organize your ArcGIS API for JavaScript project locally, you can use NPM, the current hot front-end JS package management tool, to manage the API in your project starting with 4.7.

Previously, ESRI was recommended to use Bower as the package management tool, and it is now recommended that NPM be used, although it is still possible to use bower, but it is recommended to use NPM.

In advance, you may need to install:

    • node. js
    • Git
    • Grunt
    • Java version 7 or later

In fact, you just need to install node. js. The other three can be installed as needed.

2. How to Install

One line of code

NPM Install Arcgis-js-api-Save or NPM install ArcGIS-js-API or NPM i ArcGIS-js-api

If the download is complete, the folder list should appear in the Node_modules folder:

3. Configuration

The following is the code for configuring Dojoconfig.

//Create or use existing global dojoconfigvarDojoconfig = This. dojoconfig | | {};(function() {  varConfig =Dojoconfig; //Set default Properties  if(!config.hasownproperty ("Async") ) {Config.async=true; }  //Add packages for Libs that is not siblings to dojo(function() {    varPackages = Config.packages | | []; functionaddpkgifnotpresent (newpackage) { for(vari = 0; i < packages.length; i++) {        varpkg =Packages[i]; if(Pkg.name = = =newpackage.name) {return;    }} packages.push (Newpackage); } addpkgifnotpresent ({name:"App", Location:"./.. /.. /src/app "    }); Addpkgifnotpresent ({name:"Esri", Location:".. /arcgis-js-api "    }); Addpkgifnotpresent ({name:"@dojo", Location:".. /@dojo "    }); Addpkgifnotpresent ({name:"Cldrjs", Location:".. /cldrjs ", Main:"Dist/cldr"    }); Addpkgifnotpresent ({name:"Globalize", Location:".. /globalize ", Main:"Dist/globalize"    }); Addpkgifnotpresent ({name:"Maquette", Location:".. /maquette ", Main:"DIST/MAQUETTE.UMD"    }); Addpkgifnotpresent ({name:"Maquette-css-transitions", Location:".. /maquette-css-transitions ", Main:"DIST/MAQUETTE-CSS-TRANSITIONS.UMD"    }); Addpkgifnotpresent ({name:"Maquette-jsx", Location:".. /maquette-jsx ", Main:"DIST/MAQUETTE-JSX.UMD"    }); Addpkgifnotpresent ({name:"Tslib", Location:".. /tslib ", Main:"Tslib"    }); Config.packages=packages;  })(); //Configure Map.globalize  varMap = Config.map | | {}; if(!map.globalize) {map.globalize= {      "Cldr": "Cldrjs/dist/cldr",      "Cldr/event": "Cldrjs/dist/cldr/event",      "Cldr/supplemental": "Cldrjs/dist/cldr/supplemental",      "Cldr/unresolved": "Cldrjs/dist/cldr/unresolved"    }; Config.map=map; }})();
Configure Dojoconfig

ArcGIS API for JavaScript 4.x and NPM

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.