I have a custom widget that, when I add it to the Dashboard, I get this JS error: "Uncaught Error: No store by the name 'epi.cms.contentdata' exists." The code that triggers this error is:
var storeRegistry = dependency.resolve('epi.storeregistry');this._contentStore = storeRegistry.get('epi.cms.contentdata'); // error triggers here
Any ideas what could be going on? This store is supposedly a built-in store, right?
When running in the dashboard the cms module are not loaded. You need to add the dependency in the moduleDependencies section in the module.config https://world.episerver.com/documentation/developer-guides/CMS/configuration/Configuring-moduleconfig/
I hope it solves it for you
I tried adding the following to the module.config file, but I'm still getting the exact same error:
<add dependency="CMS" type="RunAfter" />
Is this correct, or am I doing it wrong?
Hey, did you get this working. I would guess that the type of the dependency needs to be "Require" in order to force CMS to be loaded.
No, unfortunately, I did not get this working. I will try using "Require" instead of "RunAfter" and report back!
Thank you Ben, with using "Require" as the dependency type, the widget works. :)