Skip to content

Commit

Permalink
fix(stories): handle templateParameters as a promise
Browse files Browse the repository at this point in the history
got an error when trying to run storybook from Foreman: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'createSnapshot' of
undefined

ISSUES: fixes #393
  • Loading branch information
ronlavi2412 authored and MariaAga committed Apr 25, 2022
1 parent 8a7806c commit 89395ef
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions packages/stories/src/config/webpack/webpack.config.vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ module.exports = ({ config, mode }) => {
assets,
assetTags,
options
) => ({
compilation,
webpackConfig: compilation.options,
htmlWebpackPlugin: {
tags: assetTags,
files: {
...assets,
js: [...vendorJsFiles, ...assets.js],
css: [...vendorCssFiles, ...assets.css],
},
options,
},
});
) =>
Promise.resolve().then(() => {
try {
return {
compilation,
webpackConfig: compilation.options,
htmlWebpackPlugin: {
tags: assetTags,
files: {
...assets,
js: [...vendorJsFiles, ...assets.js],
css: [...vendorCssFiles, ...assets.css],
},
options,
},
};
} catch (e) {
compilation.errors.push(new Error(`Template execution failed: ${e}`));
return Promise.reject(e);
}
});

config.plugins.push(new WebpackForemanVendorPlugin({ mode }));

Expand Down

0 comments on commit 89395ef

Please sign in to comment.