Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (baseConfig, env, defaultConfig) => {
/*
This is a giant hack to override the index template used in generating the HTML
for Storybook from the default configuration:
https://github.com/storybooks/storybook/blob/7eca652b3cc68afe0003776f41e635251f0b885d/lib/core/src/server/config/webpack.config.dev.js#L46
*/
const entriesMeta = {
iframe: {
headHtmlSnippet: getPreviewHeadHtml(__dirname, process.env),
bodyHtmlSnippet: getPreviewBodyHtml(),
},
manager: {
headHtmlSnippet: getManagerHeadHtml(__dirname, process.env),
},
};
const entries = defaultConfig.entry;
const plugins = [
...Object.keys(entries).map(
e =>
new HtmlWebpackPlugin({
filename: `${e === 'manager' ? 'index' : e}.html`,
excludeChunks: Object.keys(entries).filter(i => i !== e),
chunksSortMode: 'none',
alwaysWriteToDisk: true,
inject: false,
templateParameters: (compilation, files, options) => ({
compilation,
files,
options,