Can't modify widget config.json file

11-14-2022 02:07 AM
New Contributor III

I want to store my url in config.json file, so that I can get the the url by calling 'this.props.config.url'. But the problem is whenever I try to modify the config.json file by add 'URL':'https://.....' or whatever, it is not updating while widget executed. I tried restarting the npm also restart the EB, still the issue persist. Why I can't modify the config.json file. I tried to print the config in console, I'm getting an empty result.

Any help should be appreciated. 

0 Kudos
4 Replies
Occasional Contributor III

I don't think it works like Web AppBuilder. As a matter of fact, when you publish your app, the config.json is overwritten to store the app settings (pages, sections etc....) 

In my case I stored the url in the code.

0 Kudos
Esri Contributor

Hello guys,
right now i have the same problem.
Trying to configure a simple "custom widget", after creating an application, it is impossible to change the values in its config.json after copying the application. it would seem that the only way to change a setting of a custom widget is to do it in the global configuration of the application. Is this really this? I hope not, because the global configuration grew rapidly while creating an application and thus became hardly maintainable. Surely there is something wrong with my procedure. Is there anyone who could help me, with a suggest?
Another topic is, I don't understand is what the scope of the config.son file inside the "resource" subfolder, would look like the same config.json file present in the application root folder.
I'm working for a client who wants a custom widget that can change the parameters inside.
There could be more solution to solve this problem but more complex than to change directly a paramter in the custom widget config file.

Thanks in advance

New Contributor

Hi MassimilanoGeppi,

Did you ever find a good solution to this please?  I believe I'm hitting the same issue.  I've found that whatever properties are in the config.json file when the widget is first created become the only properties available from that point on.  If the property value is updated then this is not reflected in the widget when testing in the Experience Builder Dev environment.  Similarly if a new property is added, this is also not available when querying the props.config.....

Note that whenever I add a new property to config.json I am making sure this same property is added to tyhe config.ts file.




New Contributor

Hey Dominic,

After struggling for a while, I figured this out. The widget's config.json is only read when the widget is first added to the experience. At that point, its content is added to the config.json for the EB project. If you remove and re-add the widget, it will reload the widget's config.json file. Make sure you add the appropriate properties to the config.ts. Remove and re-add seems to be the key, or start a new EB project.

0 Kudos