I'm creating a map component (using @arcgis/core) with some default layers and features and publishing it to npm to be utilized within our applications. I'm successful with rollup bundling, however the size of the unpackaged bundle is above 50 MB.
I've followed https://odoe.net/blog/arcgis-jsapi-build-tips to build my component using webpack. When using the built component used in any react application, I'm getting a series of errors unending errors.
Is it possible you could provide me with an example of how to accomplish my task?
Solved! Go to Solution.
When you use your built component in your application (the npm package) are you also using the ArcGIS JSAPI in your app? If so, you can't mix JSAPI instances in your app with your component. You'll see errors regarding the Accessor. This is equivalent to trying to create a MapView using @arcgis/core and loading a Map created with the CDN. It won't work. You can publish your component without including the JSAPI in your build, and let the build tools handle it in your app. I do something similar with this published utility library (https://github.com/odoe/explode).
When you use your built component in your application (the npm package) are you also using the ArcGIS JSAPI in your app? If so, you can't mix JSAPI instances in your app with your component. You'll see errors regarding the Accessor. This is equivalent to trying to create a MapView using @arcgis/core and loading a Map created with the CDN. It won't work. You can publish your component without including the JSAPI in your build, and let the build tools handle it in your app. I do something similar with this published utility library (https://github.com/odoe/explode).
The example helped and it worked like a charm, thanks a lot @ReneRubalcava.