arcgis-js-api npm package size

1038
5
04-06-2020 01:01 PM
MichaelHeavenor
New Contributor II

When I install the dependencies of the arcgis-js-api npm package, it installs 133MB of node_modules. When inspecting the contents of node_modules I discovered that there is a 15MB zip file in dojo-util/buildscripts (the entire buildscripts folder is over 20MB). There are are also 13MB of .jar files which seem to be useful for build time and 12MB of .html files and 11MB of .jpg files that are used almost exclusively for tests of the dojo*/dijit packages.

When looking at the package.json file for arcgis-js-api, none of the dependencies are devDependencies. To reduce bundle size for applications that depend on arcgis-js-api, is it possible to move any dependencies to devDependencies? Furthermore, for packages that cannot be moved, is it possible to remove the tests and other non-runtime code from ESRI's forks of the dojo*/dijit packages that the arcgis-js-api depends on?

Tags (1)
5 Replies
by Anonymous User
Not applicable

Hi Michael Heavenor‌,

Is that are you looking for ? Dojo Builds | ArcGIS API for JavaScript 4.14 

0 Kudos
ReneRubalcava
Frequent Contributor

At 4.15, we're removing the dgrid dependency and can remove dojo-util. Users that want to do dojo builds will not to install it manually. Other dependencies will be removed in future releases.

0 Kudos
MichaelHeavenor
New Contributor II

Hello Rene,

I had heard about the move off of dojo and I am glad to hear the some dependencies are being removed for 4.15. Splitting off dojo-util is a good idea 🙂

My project just uses the plain arcgis-js-api package without the need to use dojo to generate a custom build of the package. In this case, I only need runtime dojo dependencies. Which of the dojo dependencies are only needed for runtime? It seems like if I would like to trim the dojo packages by removing the tests (and other unneccesary files for runtime) I will have to fork the Esri/dojo packages and possibly arcgis-js-api itself.

0 Kudos
ReneRubalcava
Frequent Contributor

For 4.15, this is what is needed and will be the deps.

  "dependencies": {
    "@dojo/framework": "5.0.4",
    "dojo": "Esri/dojo#v1.14.2/esri-3.28.0",
    "dojo-dstore": "1.1.2",
    "dojox": "Esri/dojox#v1.14.2/esri-3.28.0",
    "maquette-css-transitions": "~1.1.1",
    "maquette-jsx": "~2.1.1",
    "moment": "2.24.0"
  },‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This will change at 4.16.

0 Kudos
MichaelHeavenor
New Contributor II

Thank you for your quick reply! Thanks for that list.

0 Kudos