Skip to content

Commit

Permalink
docs: add fixed gatsby config from storybookjs/storybook#22065
Browse files Browse the repository at this point in the history
  • Loading branch information
hollandjg committed Jul 25, 2023
1 parent 1831fcc commit 52b8991
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,21 @@ const config = {
babel: {
presets: ["@babel/preset-react", "@babel/preset-typescript"],
},
webpackFinal: async (config) => {
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[2].exclude = [
/node_modules\/(?!(gatsby|gatsby-script)\/)/,
]

// Remove core-js to prevent issues with Storybook
config.module.rules[2].exclude = [/core-js/]
// Use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
config.module.rules[2].use[0].options.plugins.push(
require.resolve("babel-plugin-remove-graphql-queries")
)

config.resolve.mainFields = ["browser", "module", "main"]
return config
},
}
export default config

0 comments on commit 52b8991

Please sign in to comment.