Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikko Ankkala committed Apr 4, 2022
1 parent 9ebea39 commit aba3006
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .storybook/craco.storybook.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const cracoConfig = require('../craco.config');

/**
* Add a plugin to remove ModuleScopePlugin from webpack when running storybook because it messes
* with storybook-preset-craco.
*/

cracoConfig.plugins.push({
plugin: {
overrideWebpackConfig: ({ webpackConfig }) => {
webpackConfig.resolve.plugins = webpackConfig.resolve.plugins.filter(
(plugin) => plugin.constructor.name !== 'ModuleScopePlugin'
);

return webpackConfig;
},
},
});

module.exports = cracoConfig;
9 changes: 8 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path')

module.exports = {
"stories": [
"../src/**/*.stories.mdx",
Expand All @@ -6,7 +8,12 @@ module.exports = {
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"storybook-preset-craco" // changing this line to "@storybook/preset-create-react-app" fixes storybook build
{
name: 'storybook-preset-craco',
options: {
cracoConfigFile: path.join(__dirname, 'craco.storybook.config.js'),
},
},
],
"framework": "@storybook/react",
"core": {
Expand Down
1 change: 1 addition & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
// Nothing here in particular
plugins: []
};

0 comments on commit aba3006

Please sign in to comment.