Packaging an addon
See original GitHub issueI made a nice addon that shows you the QR code of the current story you are on (for mobile web testing) and I can’t figure out how to package it.
This works fine when I import it in my project, in addons.js:
import React from 'react'
import addons from '@storybook/addons'
const externalUrl = process.env.STORYBOOK_URL || window.location.origin
addons.register('local_qr', api => {
class QRPanel extends React.Component {
constructor (props) {
super(props)
this.state = {url: ''}
this.handleUrl = this.handleUrl.bind(this)
}
componentDidMount () {
api.onStory(this.handleUrl)
}
handleUrl (kind, story) {
const url = `${externalUr}/iframe.html?selectedKind=${encodeURIComponent(kind)}&selectedStory=${encodeURIComponent(story)}`
this.setState({url})
}
render () {
return (
<div>
<img
height={200}
width={200}
src={'https://chart.googleapis.com/chart?cht=qr&chs=200x200&chl=' + encodeURIComponent(this.state.url)}
/>
<div>{this.state.url}</div>
</div>
)
}
}
addons.addPanel('local_qr/panel', {
title: 'QR Code',
render: () => <QRPanel />
})
})
But when I put it in it’s own project and link to it via file:/// url in package.json in another project, it doesn’t seem to be registering (the QR panel isn’t created, and things inside addons.register aren’t called. A console.log in the top of my register file is called, however, so I know it’s loading.
Issue Analytics
- State:
- Created 6 years ago
- Comments:24 (19 by maintainers)
Top Results From Across the Web
Most Common Addons Used By Packaging Companies | ECB
Various types of these add-ons are used for multiple types of custom packaging. Attachments are added attributes or one-of-a-kind aspects that ...
Read more >AddOn Packaging — Koverse 2.9 documentation
AddOn Packaging ¶. Custom sources, sinks, authentication mechanisms, and analytics are plugged into Koverse via simple packages called AddOns.
Read more >Addon Packages: Purchase Access to a Page, Post or “Thing”
Admin designates a post as an “addon package” by setting a price for access and selecting which membership levels can purchase the package....
Read more >Packing AddOn for SAP - SAP Community
Hi everybody, I'm new in SBO Development, and i have one question about packaging an add'on. I'm developing an addOn using Visual Basic...
Read more >How to package a Django application as an Aldryn addon
Select Package Information from your addon's menu. Download the packaging files, and add them to the addon. It should look something like this:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@konsumer I tried your addon on my machine locally and everything worked fine (except the gitignore issue)
Maybe it will be useful to left the steps I did to run it (and maybe you can follow them from scratch as well):
I just published it on npm, and it works fine, so my point is the instructions for local development need a change, as they don’t work as-is.