ROLLBACK the change to allow for any string to be loadable, as this is nightmare-scenario for webpack

"Critical dependency: the request of a dependency is an expression"

Instead allow the array to contain "functions that do the require & return exports" or "the exports directly"
This commit is contained in:
Norbert de Langen 2019-11-15 00:24:04 +01:00
parent 8899e90c13
commit cb49e217fb
2 changed files with 8 additions and 7 deletions

View File

@ -94,7 +94,8 @@ function configure(
});
if (stories && stories.length) {
storybook.configure(stories, false);
// eslint-disable-next-line global-require, import/no-dynamic-require
storybook.configure(stories.map(f => require(f)), false);
}
}

View File

@ -358,12 +358,12 @@ export default function start(render, { decorateStory } = {}) {
typeof req.resolve === 'function' ? req.resolve(filename) : null
);
});
} else {
const fileExports = require(req);
currentExports.set(
fileExports,
typeof req.resolve === 'function' ? req.resolve(filename) : null
);
} else if (typeof req === 'function') {
const fileExports = req();
currentExports.set(fileExports, null);
} else if (typeof req === 'object') {
const fileExports = req;
currentExports.set(fileExports, null);
}
});
} else {