Gatsby Storybook configuration produces 'uncaught TypeError: $ is not a function' on Webpack #33060
Unanswered
VernerKeel
asked this question in
Help
Replies: 1 comment
-
It seems duplicated from #32512. I'd suggest a module.exports = {
// You will want to change this to wherever your Stories will live
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: ["@storybook/addon-links", "@storybook/addon-essentials"],
core: {
builder: "webpack5",
},
webpackFinal: async config => {
// Transpile Gatsby module because Gatsby includes un-transpiled ES6 code.
config.module.rules[0].exclude = [/node_modules\/(?!(gatsby)\/)/]
config.module.rules[0].exclude = [/core-js/] // new line
// use babel-plugin-remove-graphql-queries to remove static queries from components when rendering in storybook
config.module.rules[0].use[0].options.plugins.push(
require.resolve("babel-plugin-remove-graphql-queries")
)
config.resolve.mainFields = ["browser", "module", "main"] // new line
return config
},
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Preliminary Checks
Description
I tried to configure Storybook on Gatsby by following this guide: [Visual Testing with Storybook guide] (https://www.gatsbyjs.com/docs/how-to/testing/visual-testing-with-storybook/). When running
npm run storybook
I got indefinitely loading Storybook UI:Error message on Chrome Dev Tools console:
Uncaught TypeError: $ is not a function
I tried both: manual configuration and using an addon. Finally, I upgraded all related dependencies to @next.
Reproduction Link
https://github.com/vernerkeel/examples-live/tree/live/gatsby-storybook-test
Steps to Reproduce
Expected Result
I expected Storybook's UI to complete loading and show stories.
Actual Result
Storybook's UI kept loading indefinitely and couldn't display stories.
Environment
Config Flags
No response
Beta Was this translation helpful? Give feedback.
All reactions