1

We switched to NPM workspaces to share source code. Works fine.

We want to go further and utilize NPM workspaces to share dependencies. Like every WEB app in monorepo should be built with Next.js v14.0.3 - not any other version.

How could we achieve version sharing?

1 Answer 1

0

Seems we are able to define a workspace with empty index.js solely for the purpose of defining a dependency list, to consume it transitively:

{
  "name": "@corp/static-nextjs-site",
  "version": "0.0.1",
  "dependencies": {
    "express": "^4.18.3",
    "http-proxy-middleware": "^2.0.6",
    "morgan": "^1.10.0"
  }
}

and then include it into other submodules (workspaces):

  "dependencies": {
    "@corp/static-nextjs-site": "^0.0.1",
    ...

This way it is possible to share version specification in workspace managed mono-repo.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.