mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
Merge pull request #10974 from luke-j/next
Core: Log swallowed errors when requiring stories
This commit is contained in:
commit
a38451fdda
@ -24,13 +24,17 @@ const loadStories = (
|
||||
if (reqs) {
|
||||
reqs.forEach((req) => {
|
||||
req.keys().forEach((filename: string) => {
|
||||
const fileExports = req(filename);
|
||||
currentExports.set(
|
||||
fileExports,
|
||||
// todo discuss: types infer that this is RequireContext; no checks needed?
|
||||
// NOTE: turns out `babel-plugin-require-context-hook` doesn't implement this (yet)
|
||||
typeof req.resolve === 'function' ? req.resolve(filename) : null
|
||||
);
|
||||
try {
|
||||
const fileExports = req(filename);
|
||||
currentExports.set(
|
||||
fileExports,
|
||||
// todo discuss: types infer that this is RequireContext; no checks needed?
|
||||
// NOTE: turns out `babel-plugin-require-context-hook` doesn't implement this (yet)
|
||||
typeof req.resolve === 'function' ? req.resolve(filename) : null
|
||||
);
|
||||
} catch (error) {
|
||||
logger.warn(`Unexpected error: ${error}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user