-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Using a Gatsby app as a package within a monorepo works #9352
Comments
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Is this stale, or has the inkteam not reviewed yet? I'd be keen to shed some light on this, although not critical. Feel free to close otherwise. |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
I'm evaluating Gatsby in a monorepo environment. I found this issue through a Google search. Thank you for doing a writeup on it :). |
I did find this Gatsby blog entry about monorepos on Lerna. I am thinking that if its on the official blog, it means its officially supported. https://www.gatsbyjs.org/blog/2019-01-01-publish-multiple-gatsby-sites/ |
@johntran Oh interesting, ty for the blog link! 👀 |
Hi @jedrichards I just found this issue after updating my own issue regarding Gatsby in a monorepo with lerna. The way I got gatsby to work was to add it as a dependency in the project root! See #11780 Unfortunately I'm having issues with a small handful of plugins, but other than that Gatsby does work in a monorepo |
@josefaidt Have a look at my example repo. You might need to use https://github.com/jedrichards/monorepo-test/blob/master/gatsby-app/package.json#L38-L40 |
Yes I just jumped into that repo and saw that |
@jedrichards how are you able to get this to work? "workspaces": {
"packages": ["*"]
} I tried adding this to my workspace and then yarn wouldn't pick anything up until I made it back to an array. I was originally following this piece from the yarn documentation where it claims workspaces should be an array. That being said I cloned your repo and installed the dependencies (including the ones I was having trouble with) and do not have a single issue. EDIT: found the blog post where it goes over that spec. Might be time to update their documentation on workspaces 😬 |
@josefaidt I think just |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contributefor more information about opening PRs, triaging issues, and contributing! Thanks for being a part of the Gatsby community! 💪💜 |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
Summary
I was surprised to discover that Gatsby is able to operate normally as a package within a monorepo, while importing and transpiling source code from other packages in the monorepo with its Webpack config.
Example repo: https://github.com/jedrichards/monorepo-test
Relevant information
My assumption was that Gatsby would treat monorepo packages as it does everything from
node_modules
and exclude from compilation. Indeed, create-react-app recently backed off this sort of feature for its v2:My example repo above is the simplest case, but I've tested more advanced setups (TypeScript, CSS Modules) and it seems like Gatsby is happily compiling these features found in code in the
@monorepo-test/components
package (which is resolved via a symlink in the monorepo's root node_modules).I think it's rather good this just works, but was keen to find out more and whether this is a expected/supported use case before I base a whole set of projects on it. I couldn't find anything about it in the documentation.
Environment
The text was updated successfully, but these errors were encountered: