Esri / feedback-js-api-next

Try out the next release of the ArcGIS Maps SDK for JavaScript and share your feedback. Be warned: this release is still in development and is unstable.
87 stars 23 forks source link

Enhancement: Including the @arcgis/core library in my SPFX SharePoint webpart #90

Closed jscudder closed 3 years ago

jscudder commented 3 years ago

When I include the @arcgis/core/assets contents in my SharePoint online SPFX webpart, SharePoint complains there are too many files (over 1000) included with my webpart. I know this is happening due to the number of files in @arcgis/core/assets. Is there any way I can bundle @arcgis/core/assets contents in my project to avoid this? Right now I am able to get a basic map showing (but without zoom, navigation, compass, popup and attribution controls) by including a line in the webpart: SPComponentLoader.loadCss('https://js.arcgis.com/4.18/esri/themes/dark/main.css');

SpfxWebpartErrorEsriArcGisAssets
andygup commented 3 years ago

@jscudder you can experiment with manually removing some of the subdirectories under /assets. Once you remove a subdirectory you'll need to exercise all parts of your app to make sure you haven't removed something that is required.

For example:

Just some ideas that could reduce the number of files quite a bit.

jscudder commented 3 years ago

Here is what I did instead, and this workaround is working perfectly so far. I am no longer hosting the assets inside a SharePoint site. When my SharePoint map webpart is loading I make these two calls:

SPComponentLoader.loadCss("https://cdn.jsdelivr.net/npm/arcgis-js-api@4.18.0-next.20201213/assets/esri/themes/dark/main.css"); config.assetsPath = 'https://cdn.jsdelivr.net/npm/arcgis-js-api@4.18.0-next.20201213/assets';

Everything is working perfectly now with no more errors or UI issues.