-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for using react-cosmos with gatsby #17
Comments
Hi @EliotSlevin, Indeed this would be valuable. I don't have any experience with Gatsby, but it would definitely help if you would share more details. Maybe I see something obvious or someone else will help. Eg. when you changed the webpack config to Gatsby's webpack config, did it make a difference? What does your Cosmos config look like and what do the terminal logs say? Are you getting any errors? Etc. If you can share your project it would be even better. |
Here's is the simplest gatsby website example I could think of, attempted to be configured with react-cosmos. Instructions to run in the read-me. https://github.com/EliotSlevin/cosmos-gatsby-example Notice I've tried to override the webpack config with gatsby's own webpack config in If you run cosmos without the config file I get back
If you run cosmos with that config, either as
I'm pretty sure I've got that path right so I'm really not sure where I'm going wrong. And even if I didn't use the gatsby webpack config, it's so weird that it's throwing an error that the experimental feature JSX isn't enabled? I just really don't know enough about babel and webpack to know what I'm doing, if anyone could get that repo working with cosmos I'd love to take a look at how it was done. |
Thanks for providing this. At first glance, it's pretty clear that Gatsby's webpack config isn't a standard webpack config. It requires a few arguments (program, directory, suppliedStage, port, parentSpan) that are specific to Gatsby, so it cannot be used as a regular webpack config, unless you know what to pass in into those arguments. There are two options:
For both you need Gatsby knowledge, which I don't have. If you can find someone with the Gatsby knowledge I can continue to offer assistance on the Cosmos side. |
Hi there,
I've been trying to configure react-cosmos to use in a gatsby website, with little success. I've changed the webpack config to gatsby's config, read the compilation section of the docs 10x but I'm still getting nowhere. The reality I picked Gatsby because I don't want to get involved in all the nitty details of webpack building etc. And I'm not even sure if I'm heading in the right direction.
In the docs there are examples of configuring cosmos to work with create-react-app, and next.js. It would be great if there could also be a section detailing using react-cosmos with Gatsby, with some examples.
I've tried several other component viewing libraries and failed to integrate them all (including Storybook) - so making cosmos an easy option for Gatsby users and react-cosmos would be very appealing.
Cheers
The text was updated successfully, but these errors were encountered: