NPM Package?

5593
13
Jump to solution
11-24-2015 07:33 PM
JoshKing
New Contributor II

Will the 4.0+ js library be available as a npm package?

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor

The 4.0 API won't be available on NPM for a few reasons.

The Dojo dependencies which include dojox/dijit/dgrid/xstyle/put-selector and the build tools in util are not available via NPM, so dependency management via NPM wouldn't work very well.

NPM also doesn't lend itself well to downloading files to specific directories as shown in the samples.

When building with AMD, you'd ideally want each package in your src directory. You can setup dojoConfig to work around this, but again, you'd be pointing to bower_components for some deps and node_modules for others. This gets ugly quickly.

Bower is not being deprecated, they are just looking for more maintainers. That was more unfounded internet rumors that spread around.

Truth be told, by using Bower, we can make sure that users get the correct dependencies to do local builds. In our case, it really is the best choice at the moment.

You can see a demo using 3.x to do local builds here.

That's not to say that there won't be an NPM release in the future, just not with 4.0.

View solution in original post

13 Replies
BjornSvensson
Esri Regular Contributor

I'm assuming you mean as a Bower package, like we've added for 3.x - https://developers.arcgis.com/javascript/jshelp/inside_bower_custom_builds.html.

Yes, the plan is to do this for the "4.0" production release (but probably not for the betas).

NathanLe_Ray
New Contributor

Hi!

I think he really means a NPM package as in Node Package Manager.

Bower is being deprecated in favor of NPM module.

It would really help to have a NPM module in order to use the API easily whih other loaders such as SystemJS (Angular 2).

Thanks.

0 Kudos
JeffJacobson
Occasional Contributor III

Who says that Bower is being deprecated?

Edit: I am not seeing anything on the Bower website about support ending or anything like that, and the project seems to still be active on GitHub. What is the basis for saying that it is "deprecated"?

0 Kudos
JoshKing
New Contributor II

Agreed.  Many shops are moving away from Bower.  My current web projects just have a package.json utilized from Webpack.  So as long as I can do a npm install, that would be great.   

0 Kudos
DanielBaternik1
New Contributor

Do you mind sharing how you're using webpack with the arcgis js api? That would be a huge help to the increasing number of webpack devs.

0 Kudos
ReneRubalcava
Frequent Contributor

The 4.0 API won't be available on NPM for a few reasons.

The Dojo dependencies which include dojox/dijit/dgrid/xstyle/put-selector and the build tools in util are not available via NPM, so dependency management via NPM wouldn't work very well.

NPM also doesn't lend itself well to downloading files to specific directories as shown in the samples.

When building with AMD, you'd ideally want each package in your src directory. You can setup dojoConfig to work around this, but again, you'd be pointing to bower_components for some deps and node_modules for others. This gets ugly quickly.

Bower is not being deprecated, they are just looking for more maintainers. That was more unfounded internet rumors that spread around.

Truth be told, by using Bower, we can make sure that users get the correct dependencies to do local builds. In our case, it really is the best choice at the moment.

You can see a demo using 3.x to do local builds here.

That's not to say that there won't be an NPM release in the future, just not with 4.0.

MichaelMatuszak
New Contributor II

FYI, most of the dependencies mentioned are now available in NPM:

dojox / dijit / dgrid / put-selector 

And it's not a matter of whether or not Bower is supported, but that it's not the best choice for a lot of developers anymore, particularly when using ES6 modules or TypeScript.  Considering we currently have to mitigate the Dojo AMD loader interfering with the module loader we actually want to use, having it be part of the reason for not having an NPM module is doubly frustrating.

ReneRubalcava
Frequent Contributor

Build scenarios for these are currently being evaluated. There are still things that need to be tested. Even when using ES6 or TS, it still would need to be transpiled to AMD for use with the Dojo loader and loader plugins. There is already a system-js loader that will work with Angular 2 and other systemjs based frameworks.

0 Kudos
JeffJacobson
Occasional Contributor III

The TypeScript compiler is capable of outputting AMD. See the module flag in the Compiler Options documentation.

0 Kudos