Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open browser automatically on run #546

Closed
evandavis opened this issue Oct 13, 2016 · 7 comments
Closed

Open browser automatically on run #546

evandavis opened this issue Oct 13, 2016 · 7 comments

Comments

@evandavis
Copy link

evandavis commented Oct 13, 2016

Hi, I'm trying to use the open-browser-webpack-plugin to launch my storybook in the browser as soon as it's ready. However, when I use this plugin, the server hangs and doesn't render anything.

I opened an issue on that repo as well because I'm not sure where the problem lies. (My suspicion is that it's something in the way that plugin unregisters after build conflicting with the HMR plugin?)

Here's the webpack config I'm using in my storybook:

const OpenBrowserPlugin = require('open-browser-webpack-plugin');

module.exports = {
  plugins: [
    new OpenBrowserPlugin({url: 'http://localhost:9001/'})
  ]
};

Thanks!

@arunoda
Copy link
Member

arunoda commented Oct 13, 2016

@evandavis I haven't used this plugin personally.
But I assume, this is something related to plugin itself.

@ericandrewlewis
Copy link

Hey there,

the Webpack team added this option to webpack-dev-server which I think is swell. Maybe Storybook can do similar? so then start-storybook --open could open the browser automatically on start?

@texttechne
Copy link

Was a bug in the open-browser-webpack-plugin. See: baldore/open-browser-webpack-plugin/issues/11
@evandavis This ticket can be closed then, right?

@evandavis
Copy link
Author

@texttechne correct, fixed in baldore/open-browser-webpack-plugin#11.

@ericandrewlewis
Copy link

@shilman are you into adding this as an option to storybook itself? I'd be down to work on it :)

@shilman
Copy link
Member

shilman commented Jun 21, 2017

@ericandrewlewis i'm not familiar with that webpack plugin, but if it works well, sure that would be a great addition! thanks!

@nathanmcwpe
Copy link

nathanmcwpe commented Nov 7, 2017

found a quick fix that does this, however the browser loads and waits until the build is finished, but if you can deal with that:

first install the openurl package

then edit /node_modules/.bin/start-storybook and add the line (under require('../dist/server');):

require("openurl").open("http://localhost:9009")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants