Closed thani-sh closed 8 years ago
We need to check with @tomitrescak he is using NPM2?
We need to do some webpack hack and try to load the same @kadira/storybook-addons
in all the cases. (Using webpack's alias)
Then we may use @kadira/storybook-addons
as a peer dependancy.
Not sure this'll fix that issue, then we know everyone on the same page.
All addons have @kadira/storybook-addons
as a peer dependency and @kadira/storybook
has it as a dependency. So it should work fine, right?
@mnmtanish Ah yes. In that case, it should work properly.
May be the version of @kadira/storybook-addons
in the @kadira/storybook
is a older one.
Which don't have that emit
method.
So, when the user installed @kadira/storybook-addons
manually it will show up properly.
The emit
method comes from the channel. From the error we can see that the user got null
instead of the channel. This can happen when multiple versions of @kadira/storybook-addons
gets loaded somehow. I think the one on react-storybook gets the addons.setChannel
call and the one (somehow) loaded by the addon gets the addons.getChannel
call.
Is there any node feature to make sure only one version of a module gets loaded? Is it okay to use a global variable to check whether multiple versions are loaded?
Guys, the error was that I was using older version of storybook ... shame on me :/
Thanks @tomitrescak. The think I guess might be correct. I think we can close this now.
FYI, if you run into this while developing addons, I had to update .storybook/webpack.config.js
:
const path = require('path');
module.exports = {
...<your wepback conf>...
resolve: {
alias: {
'@kadira/storybook-addons': path.join(__dirname, '../node_modules/@kadira/storybook-addons'),
},
},
};
Related issue: https://github.com/mthuret/storybook-addon-specifications/issues/1
This issue is somewhat weird:
@tomitrescak got the error message
Which means that the
addons
variable here must be already available andaddons.getChannel()
call was successful. Which means@kadira/storybook-addons
was already available.The weird thing is that it started working once he installed
@kadira/storybook-addons
. Maybe it was some node module version mixups or its something else.I checked the mthuret/storybook-addon-specifications code and the way it's using
addons.getChannel()
is fine. I tried setting up this addon with the react-button repo and it also worked fine.cc: @arunoda @roonyh