From a348cd1d206b740b84e627f847587f9afdafe68b Mon Sep 17 00:00:00 2001 From: meriadec Date: Tue, 31 Jul 2018 11:12:03 +0200 Subject: [PATCH] Fix storybook --- src/helpers/linking.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) }