I have upgraded the storybook of a project to 6.5.16 and am currently facing the problem, that the stories are not showing. The sidebar shows story titles and the story itself, but clicking on either doesn’t do anything. I am getting a devtools warning
DevTools failed to load source map: Could not load content for http://localhost:8080/index.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
but not sure whether that’s relevant.
main.ts
const config: StorybookConfig = {
stories: ["../src/**/*.tsx"],
addons: [
"@storybook/addon-actions",
"@storybook/addon-knobs",
"@storybook/addon-essentials",
"@storybook/addon-viewport",
],
features: {
storyStoreV7: true,
},
framework: "@storybook/react",
core: {
builder: "@storybook/builder-webpack5",
},
staticDirs: [path.resolve(__dirname, "../resources")],
webpackFinal: async (config: any) => {
if (config.resolve?.alias) {
config.resolve.alias = {
...config.resolve.alias,
"@style-variables": path.resolve(__dirname, "../src/styles/variables"),
};
}
if (config.plugins) {
config.plugins.push(new MiniCssExtractPlugin({ filename: "[name].css" }));
}
if (config.module?.rules) {
config.module.rules.push({
test: /.(sa|sc|c)ss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {},
},
"css-loader",
{
loader: "sass-loader",
options: {
implementation: require("sass"),
sassOptions: {
includePaths: [
path.resolve(__dirname, "./../../../node_modules"),
],
},
},
},
],
});
}
return config;
},
};
module.exports = config;
Also got a preview.js
addParameters({
docs: {
container: DocsContainer,
page: DocsPage,
},
});
function loadStories() {
require("./../dist/index.js");
}
const storyWrapper = (story) => (
<div className="storywrapper" style={{ margin: 35 }}>
{story()}
</div>
);
addDecorator(
withInfo({
inline: true,
header: false,
source: true,
maxPropsIntoLine: 1,
})
);
addDecorator(storyWrapper);
configure(loadStories, module);
and this as an example story:
export default {
title: 'Selector',
decorators: [withKnobs],
};
export const Default = () => (
<Component
isDisabled={ isDisabled() }
items={ SELECTOR_ITEMS }
selectedItem={ SELECTOR_ITEMS[0] }
/>
);
(left the imports out)
As I wrote, the stories seem loaded but are not showing. Please help 🙂