Gatsby uses Webpack 1, while Storybook uses Webpack 3, making it really hard to get both to work together in the same project.
I've tried a few different workarounds including moving Storybook to its own package with a separate node_modules directory (then it runs but no stories appear) etc, and I'm completely stuck. I'd love any help that anyone can provide.
Gatsby version: 1.9.215
Node.js version: v8.9.4
Operating System: OS X 10.13.3
As per: https://github.com/craigcoles/gatsby-storybook
$ gatsby develop
success delete html and css files from previous builds โ 0.009 s
success open and validate gatsby-config.js โ 0.009 s
success copy gatsby files โ 0.032 s
success onPreBootstrap โ 0.023 s
success source and transform nodes โ 0.039 s
success building schema โ 0.128 s
success createLayouts โ 0.040 s
success createPages โ 0.001 s
success createPagesStatefully โ 0.026 s
success onPreExtractQueries โ 0.001 s
success update schema โ 0.076 s
success extract queries from components โ 0.064 s
success run graphql queries โ 0.038 s
success write out page data โ 0.007 s
success write out redirect data โ 0.001 s
success onPostBootstrap โ 0.001 s
info bootstrap finished - 5.669 s
error There was an error compiling the html.js component for the development server.
See our docs page on debugging HTML builds for help https://goo.gl/yL9lND
Error: Module build failed: TypeError: fileSystem.statSync is not a function
- exists.js:7 module.exports
[gatsby-storybook]/[babel-loader]/lib/utils/exists.js:7:25
- resolve-rc.js:13 find
[gatsby-storybook]/[babel-loader]/lib/resolve-rc.js:13:9
- index.js:113 Object.module.exports
[gatsby-storybook]/[babel-loader]/lib/index.js:113:132
Gatsby should run.
1. Clone the repository at https://github.com/craigcoles/gatsby-storybook
2. Run yarn or npm i in the new directory
3. Run gatsby develop
@craigcoles, thanks so much for your help! Iโll give it a try tomorrow and will let you know if I have any trouble.
Works a treat, thanks so much!
Just chiming in for the curious: babel-loader 7.1.2, 7.1.3, and 7.1.4 don't work. Only 7.1.1 does... this is very strange.
@craigcoles This fixed it for me too.
Most helpful comment
Managed to get this working by using babel-loader 7.1.1:
[Credit]