Open nicwaller opened 5 years ago
+1 Yeah I'm interested in something similar 👍
Any progress here?
Hate to do this but.... +1
For anyone else coming here... You can use Yarn workspaces in a monorepo setup by keeping your base directory set to your project's root directory. This will properly find/link dependencies properly across different package trees as long as your dependencies work in yarn on your local system.
However, this means that if you have multiple sites deploying from the same git repo, you're not able to ignore builds and each site will rebuild even if files in that sub-folder haven't changed. It's not an ideal solution, but it works for now.
[edit] I also discovered a small workaround on another of Netlify's repos that allows you to work more closely to a Yarn/Lerna monorepo setup.
same issue still here, pain in the ass to work around.
Maybe this will help.
shared
in react-app
using yarn link[build]
command = "yarn workspace react-app build"
publish = "packages/react-app/dist"
More about yarn workspaces
About me
My question in a little more detail
How can Netlify be used with a yarn monorepo where the package being deployed includes other packages in the same repo?
For example, I am developing a React application with a Serverless backend (deployed to AWS Lambda separately), all in TypeScript. They have a bit of shared code which I've put into the
shared
directory. My file structure looks like this:And netlify.toml looks like this:
When
react-app/package.json
contains only globally-resolvable modules from npm, everything works fine. But when I add a dependency on theshared
module which is only available locally (not published in npm) I get a missing module error.Does Netlify support this style of monorepo deployment? If yes, is there a guide somewhere, or plans to develop a guide?
Additional comments for Netlify
I'm a huge fan of Netlify. Recently a coworker asked me to help their teenage child set up a website, and I had them up and running with Netlify in under 15 minutes. Quick and painless!