diff --git a/src/helpers/linking.js b/src/helpers/linking.js index e810f123..36855a21 100644 --- a/src/helpers/linking.js +++ b/src/helpers/linking.js @@ -1,12 +1,17 @@ // @flow -import { shell } from 'electron' import { track } from 'analytics/segment' +let shell +if (!process.env.STORYBOOK_ENV) { + const electron = require('electron') + shell = electron.shell +} + export const openURL = ( url: string, customEventName: string = 'OpenURL', extraParams: Object = {}, ) => { track(customEventName, { ...extraParams, url }) - shell.openExternal(url) + shell && shell.openExternal(url) }