Basemap does not display when bundled/minimized

1044
5
Jump to solution
05-27-2022 07:36 AM
FunkMonkey33
Emerging Contributor

Hi ESRI community!

First post here, and fairly new to the ArcGIS API for JavaScript, so please bear with me!

My web app is in Angular 13, and uses version 4.23.7 of the API.  I'm using ES modules.  

The map works fine in our local development environments, and in our deployed Test environment.  It does not display the basemap (or our graphic layer) in our Staging and Production environments.  The difference is that Staging and Production are bundled/minimized, while the local development and Testing environments are not.

The error message I'm getting is 

main.js:118 [esri.layers.VectorTileLayer] #load() Failed to load layer (title: 'Light Gray Canvas Labels', id: '18105e27efe-layer-2')

There is an inner exception here:

TypeError: w is not a function or its return value is not iterable at X (https://xxxx.xx.xxx/5460.js:1:307) at ae._initializeTilemapDefinition

The map div does load, and shows the zoom in/out buttons (the + and - icons), as well as the "Powered by Esri) attribution label in the bottom-right corner of the map.  But no tiles.

Thanks for reading this post, and any ideas you have.  Very excited to be part of this community!

Aaron

  

0 Kudos
1 Solution

Accepted Solutions
FunkMonkey33
Emerging Contributor

It did turn out to be a timing issue.  We are now awaiting the mapView's ready property to be true before we work with the map.  And our issue is resolved!

Thanks for your help!

View solution in original post

0 Kudos
5 Replies
AndyGup
Esri Regular Contributor

@FunkMonkey33  It might be a transpiler issue - take a look at the browserslistrc in our Angular sample => https://github.com/Esri/jsapi-resources/blob/master/esm-samples/jsapi-angular-cli/.browserslistrc.

0 Kudos
FunkMonkey33
Emerging Contributor

Thanks.  Our .browserslistrc has the same contents as the one referenced above.

A colleague of mine has suggested it could be a timing issue.  We don't wait for an event from the map indicating loading/initialization are complete.  We just use ngOnInit() which says that the component is initialized, but it may work locally/in our Test environment because the map loads faster.  

Maybe we should await mapView.ready before adding any layers? Is there a better event?

Thanks!

0 Kudos
AndyGup
Esri Regular Contributor

The error signature looks more related to a compiler issue than an application life-cycle error, for example there aren't any null or undefined values. I talked to one of my vector tile layer colleagues and they hadn't seen that error before. Can you share a github link to a simple repository that reproduces the issue?

Oftentimes going through the exercise of creating a simple repro helps uncover the underlying issue. Without a repro case there's not much more we can do, there are too many variables and permutations of dependencies.

0 Kudos
AndyGup
Esri Regular Contributor

Oh, one more thought. Even if it is a life-cycle issue related to something like a Symbol.iterator, we'd still need a repro case to figure out what part of the API might be choking.

0 Kudos
FunkMonkey33
Emerging Contributor

It did turn out to be a timing issue.  We are now awaiting the mapView's ready property to be true before we work with the map.  And our issue is resolved!

Thanks for your help!

0 Kudos