After you upgraded to the latest Kentico 13 hotfix or environment variable changed from Development to Production, you’re getting the error “Cannot read properties of undefined (reading ‘mediaFilesSelector’)” or “Cannot read properties of undefined (reading ‘pathSelector’)” when trying to edit a widget with MediaFilesSelectorItem or PathSelectorItem property.
The debugger points to window.kentico.modalDialog, which is used by both properties MediaFilesSelectorItem and PathSelectorItem.
To fix the issues, head over to Program.cs and add .UseStaticWebAssets() for the webBuilder.
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { webBuilder .UseIISIntegration() .UseStartup<Startup>() .UseStaticWebAssets(); });
Make the above changes and Rebuild your site.