From fd50660b15668f61daa51d3412d617a8eb5dab26 Mon Sep 17 00:00:00 2001 From: meriadec Date: Mon, 19 Feb 2018 15:19:51 +0100 Subject: [PATCH] Prevent throw of staticPath helper in storybook context --- src/helpers/staticPath.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/helpers/staticPath.js b/src/helpers/staticPath.js index 712cc318..8fd0ad69 100644 --- a/src/helpers/staticPath.js +++ b/src/helpers/staticPath.js @@ -1,5 +1,6 @@ -const isRunningInAsar = process.mainModule.filename.indexOf('app.asar') !== -1 +const isStorybook = !process.mainModule +const isRunningInAsar = !isStorybook && process.mainModule.filename.indexOf('app.asar') !== -1 -export default (__DEV__ +export default (__DEV__ && !isStorybook ? __static : isRunningInAsar ? __dirname.replace(/app\.asar$/, 'static') : `${__dirname}/../static`)