Esri/react-arcgis

Refactoring to use @arcgis/core

sebastianfrey opened this issue · 5 comments

I have the following question:

Are there any plans on the road to refactor this package to use the ES-Modules available through @arcgis/core?

I know this would imply some further questions:

  • Has the current way to load the ArcGIS JS API to be supported any longer (esri-loader)?
  • How much work would be required to support esri-loader as well as @arcgis/core to load the ArcGIS JS API?
  • ...

Thanks in advance for your time and best regards.

Hi @sebastianfrey, I'll let @gavinr answer your first question but I can tackle the other two.

Has the current way to load the ArcGIS JS API to be supported any longer (esri-loader)?

We plan on keeping esri-loader around, and we we are recommending using @arcgis/core for new projects that require local builds. If you have a couple minutes, I suggest taking a look at the Developer Tooling overview in the SDK: https://developers.arcgis.com/javascript/latest/guide/tooling-intro/.

How much work would be required to support esri-loader as well as @arcgis/core to load the ArcGIS JS API?

Do you mean use both within a single application? If that's what you are asking about we don't have any plans to support that coding pattern.

Are there any plans on the road to refactor this package to use the ES-Modules available through @arcgis/core?

There are no current plans for this. It would make sense for this to use @arcgis/core, but there are potential drawbacks, specifically longer build times and potential compatibility w/ some build tools (Parcel, Snowpack, WMR, etc). I doubt those are commonly used w/ these components.

If someone wants to make a PR to use @arcgis/core I'd be open to it. We could release it w/ a major version bump (v6), and people could always use the older version (v5) if the above drawbacks are an issue for them. Besides, there's always https://github.com/tomwayson/esri-loader-hooks ;)

Thank you both for taking the time answering my questions. =)

I asked, because I currently work on a larger React application which leverages esri-loader to integrate the ArcgIS-JS-API. So after I had seen that @arcgis/core reached the horizon, I tought about ways to easily switch from esri-loader to @arcgis/core. After some steady runs I came finally to the conclusion, that an ideal way to handle this transition as smoth as possible, would be when 'esri-loader' directly uses '@arcgis/core' under its hood.

@tomwayson Awesome library. In my project I came up with some similar hooks. Sadly this library wasn't available when I did start my current project. =/

From my point of view this can be closed.

Thanks @sebastianfrey

an ideal way to handle this transition as smoth as possible, would be when 'esri-loader' directly uses '@arcgis/core' under its hood

That's an interesting idea, but I don't think that will ever happen. I'm not even sure how it would work b/c loadModules() would either have to generate many dynamic import()s on the fly, or would have to have already imported all of @arcgis/core.

Unfortunately the only way I know to transition from esri-loader to @arcgis/core is to manually find and replace loadModules() calls w/ corresponding import statements.

I think we'll leave this open to see if there's any more interest in this idea.

Added a message to README encouraging people to use @arcgis/core directly in ba79e95

Closing this as we are now archiving this repo