Hi,
I'm having a hard time figuring how to import "view" from "@arcgis/core/views/View" to use the `view.whenLayerview()` function` while trying to refactor the code to use WebPack.
I am getting the following error:
uncaught TypeError: _arcgis_core_views_View__WEBPACK_IMPORTED_MODULE_0__.whenLayerView is not a function
I have also tried using "import * as view from @arcgis/core.views/View" but that didn't help.
Thanks for your replies !
Thanks for your replies!
I found the problem, my error was trying to import view from @arcgis/core module while the view needed for the whenLayerView is the reference to the MapView. importing the view from where mapview is defined instead works.
I suggest using this sample as a starting point for your app:
https://github.com/Esri/jsapi-resources/tree/master/esm-samples/webpack
If your issue is still reproducible in that sample we can take a closer look.
Tagging onto Ben's comment, add this code to that sample and it should just work:
map.add(layer); view.whenLayerView(layer).then((layerView) => { console.log(layerView); }) .catch((error) => { console.error(error); });
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.