diff --git a/lib/addons/src/index.js b/lib/addons/src/index.js index 0b2bbfeb83cc..e6baf89fdc07 100644 --- a/lib/addons/src/index.js +++ b/lib/addons/src/index.js @@ -1,8 +1,16 @@ +function channelError() { + throw new Error( + 'Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel' + ); +} + export class AddonStore { constructor() { this.loaders = {}; this.panels = {}; - this.channel = { on() {}, emit() {} }; + // this.channel should get overwritten by setChannel if package versions are + // correct and AddonStore is a proper singleton. If not, throw an error. + this.channel = { on: channelError, emit: channelError }; this.preview = null; this.database = null; }