Hi all,
I'm using ArcGIS for JavaScript 4.23.7 and I'm stuck with this problem. When I'm developing locally, in localhost url, the popup template from a webmap is showing correctly, but when I publish the application, the popup throws errors like this in the console:
[esri.widgets.FeatureViewModel] error The popupTemplate could not be displayed for this feature.
Could anyone give me any directions on what may be causing this?
Thank you.
Could it be a CORS/proxy issue? The domain of the published application is authorized within arcgis.
I just did some further testing and it looks like the problem happens after bundling the application. The localhost is working fine but after building it with vite (esbuild), the popup template fails to work. It fails on a line that is trying to use .replace at something that probably isn't a string - and thus failing.
Although I could funnel down to where the error is happening, it's still something from arcgis npm package not being able to build and I really would like an answer.
I tried with versions 4.24.7 and NEXT (4.25.0-next) of the @arcgis/core package.
cc @AndyGup
Thank you.
Hi @bsides can you provide a simple github repository that we can use to reproduce the issue? That's going to be the best way for us to help figure this out. The error message is just a generic message.
Hi, i know this is an old question. But heres my 2 cents on this, as we also had this annoying issue (altough with other modules of ArcGis).
Try to modify the optimizeDeps property in your Vite config.
If its enabled, it should look like this after modifying it.
optimizeDeps: {
disabled: false,
exclude: ['@arcgis/core'],
}
If we didnt exclude it, Vite tried to optimize ArcGis, which caused production-only bugs. Not sure as to why, because ArcGis kept giving us what seemed to be "valid" errors, in the sense that ArcGis atleast throws their own error messages leading us into dead-ends.
We had similar issues with CIMSymbols and the GeometryEngine (so far).
Hope this helps.